These are GCA analyses and model comparisons run for the reduplication study. Originally in raw R script, now in R Notebook format. It saves tables as .doc files and plots as .pdf files. This one uses the new coding of phonological repeition implemented by Kenny.
library(ggplot2)
library(broom)
library(lme4)
Loading required package: Matrix
library(bbmle)
Loading required package: stats4
library(lmerTest)
Attaching package: ‘lmerTest’
The following object is masked from ‘package:lme4’:
lmer
The following object is masked from ‘package:stats’:
step
library(sjPlot)
library(plyr)
This reads in the new dataset that includes the new coding of syllable and consonant repetition. But the script replaces the old equivalents (Adj_B, New_Redup_B) with the new variables (SyllableRepetition, ConsonantRepetition).
df = read.table(file="data_june_2018_recoded2.csv", na.strings=c("", "NA"), sep=",", header=TRUE)
df = subset(df, select = -c(New_Redup_B, Adj_B))
colnames(df)[c(46, 47)] <- c("Adj_B", "New_Redup_B")
colnames(df)[6] <- "Unique_language"
df$Trial_Iteration[is.na(df$Trial_Iteration)] <- 0 #make NAs 0 for next line to work
df <-subset(df,Trial_Iteration != 1) # keep seed languages and second round of iterations
# df <- subset(df, Transmitter == 1) # uncomment to keep only the data from the participants whose language was used to train the following generation
df_director<-subset(df,Stage!='interactM') # includes seed languages
df_matcher<-subset(df,Stage=='interactM') # includes only generations 1 to 5, since there is no accuracy for seed languages
df_director_generations_1_to_5 <- subset(df_director, Generation > 0) #excludes seed languages
contrasts(df_director$LexiconType) = contr.sum(2)
contrasts(df_director$GroupType) = contr.sum(2)
contrasts(df_matcher$LexiconType) = contr.sum(2)
contrasts(df_matcher$GroupType) = contr.sum(2)
df_director$timebin = df_director$Generation + 1
t = poly(unique(df_director$timebin), 3)
df_director[,paste("ot", 1:3, sep="")] <- t[df_director$timebin, 1:3]
df_matcher$timebin = df_matcher$Generation
t = poly(unique(df_matcher$timebin), 3)
df_matcher[,paste("ot", 1:3, sep="")] <- t[df_matcher$timebin, 1:3]
groups = ddply(df_director, c("GroupType", "LexiconType", "GroupNumber"), summarise, n=length(Block))
groups$group_id = factor(LETTERS[1:24])
df_director_plot = merge(df_director, groups, all.x = TRUE)
ggplot(df_director_plot, aes(Generation, New_Redup_B, group = group_id, colour=GroupType, linetype=LexiconType)) +
stat_summary(fun.data=mean_se, geom="line") +
ylab("Consonant repetition")+
ggtitle('Consonant repetition by group type and lexicon size')
dev.print(pdf, 'Consonant repetition by group type - dog dinner.pdf')
quartz_off_screen
2
# CVC_third_order <- glmer(New_Redup_B ~ #maximal random effect structure, up to cubic term
# (ot1+ot2+ot3) * GroupType * LexiconType + (1+ot1+ot2+ot3|Unique_Participant) +
# (1+ot1+ot2+ot3 |Meaning) + (1+ot1+ot2+ot3|Pair), data=df_director, family=binomial,
# control=glmerControl(optimizer = "bobyqa", optCtrl=list(maxfun=1e5)))
#CVC_second_order <- glmer(New_Redup_B ~ #maximal random effect structure, up to quadratic term
# (ot1+ot2) * GroupType * LexiconType + (1+ot1+ot2|Unique_Participant) +
# (1+ot1+ot2 |Meaning) + (1+ot1+ot2|Pair), data=df_director, family=binomial,
# control=glmerControl(optimizer = "bobyqa", optCtrl=list(maxfun=1e5)))
#CVC_first_order <- glmer(New_Redup_B ~ #maximal random effect structure, up to linear term
# ot1 * GroupType * LexiconType + (1+ot1|Unique_Participant) + (1+ot1 |Meaning) +
# (1+ot1+ot2|Pair), data=df_director, family=binomial,
# control=glmerControl(optimizer = "bobyqa", optCtrl=list(maxfun=1e5)))
The full models above all result in singular fit. The models converge without singular fit when all the random slopes are removed and ‘Pair’ is also removed as a random effect.Below are models with these terms dropped.
CVC_third_order <- glmer(New_Redup_B ~ #maximal random effect structure, up to cubic term
(ot1+ot2+ot3) * GroupType * LexiconType + (1|Unique_Participant) + (1|Meaning),
data=df_director, family=binomial,
control=glmerControl(optimizer = "bobyqa", optCtrl=list(maxfun=1e5)))
CVC_second_order <- glmer(New_Redup_B ~ #maximal random effect structure, up to quadratic term
(ot1+ot2) * GroupType * LexiconType + (1|Unique_Participant) + (1|Meaning),
data=df_director, family=binomial,
control=glmerControl(optimizer = "bobyqa", optCtrl=list(maxfun=1e5)))
CVC_first_order <- glmer(New_Redup_B ~ #maximal random effect structure, up to linear term
ot1 * GroupType * LexiconType + (1|Unique_Participant) + (1|Meaning),
data=df_director, family=binomial,
control=glmerControl(optimizer = "bobyqa", optCtrl=list(maxfun=1e5)))
summary(CVC_third_order)
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
Family: binomial ( logit )
Formula: New_Redup_B ~ (ot1 + ot2 + ot3) * GroupType * LexiconType + (1 | Unique_Participant) + (1 | Meaning)
Data: df_director
Control: glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 1e+05))
AIC BIC logLik deviance df.resid
5012.0 5126.5 -2488.0 4976.0 4275
Scaled residuals:
Min 1Q Median 3Q Max
-1.9153 -0.6408 -0.4376 0.8083 5.0050
Random effects:
Groups Name Variance Std.Dev.
Unique_Participant (Intercept) 0.8121 0.9012
Meaning (Intercept) 0.2797 0.5289
Number of obs: 4293, groups: Unique_Participant, 156; Meaning, 18
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.797421 0.161469 -4.939 7.87e-07 ***
ot1 0.488495 0.187113 2.611 0.00904 **
ot2 0.060052 0.178632 0.336 0.73674
ot3 -0.111754 0.153346 -0.729 0.46614
GroupType1 0.182995 0.089418 2.047 0.04071 *
LexiconType1 -0.023338 0.102203 -0.228 0.81938
ot1:GroupType1 0.319587 0.126504 2.526 0.01153 *
ot2:GroupType1 -0.024023 0.126953 -0.189 0.84992
ot3:GroupType1 -0.149515 0.127569 -1.172 0.24118
ot1:LexiconType1 -0.325435 0.187024 -1.740 0.08185 .
ot2:LexiconType1 0.105347 0.178676 0.590 0.55546
ot3:LexiconType1 0.043746 0.153343 0.285 0.77543
GroupType1:LexiconType1 0.018755 0.089352 0.210 0.83374
ot1:GroupType1:LexiconType1 0.017291 0.126475 0.137 0.89126
ot2:GroupType1:LexiconType1 -0.031397 0.126867 -0.247 0.80454
ot3:GroupType1:LexiconType1 0.007978 0.127512 0.063 0.95011
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation matrix not shown by default, as p = 16 > 12.
Use print(x, correlation=TRUE) or
vcov(x) if you need it
summary(CVC_second_order)
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
Family: binomial ( logit )
Formula: New_Redup_B ~ (ot1 + ot2) * GroupType * LexiconType + (1 | Unique_Participant) + (1 | Meaning)
Data: df_director
Control: glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 1e+05))
AIC BIC logLik deviance df.resid
5005.5 5094.6 -2488.8 4977.5 4279
Scaled residuals:
Min 1Q Median 3Q Max
-1.9033 -0.6434 -0.4386 0.8047 5.0822
Random effects:
Groups Name Variance Std.Dev.
Unique_Participant (Intercept) 0.8187 0.9048
Meaning (Intercept) 0.2798 0.5289
Number of obs: 4293, groups: Unique_Participant, 156; Meaning, 18
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.81723 0.16091 -5.079 3.8e-07 ***
ot1 0.49050 0.16355 2.999 0.00271 **
ot2 0.05608 0.15746 0.356 0.72173
GroupType1 0.20507 0.08470 2.421 0.01547 *
LexiconType1 -0.02359 0.10120 -0.233 0.81569
ot1:GroupType1 0.31018 0.12513 2.479 0.01318 *
ot2:GroupType1 -0.01850 0.12584 -0.147 0.88315
ot1:LexiconType1 -0.35122 0.16361 -2.147 0.03182 *
ot2:LexiconType1 0.13020 0.15746 0.827 0.40829
GroupType1:LexiconType1 0.02428 0.08469 0.287 0.77433
ot1:GroupType1:LexiconType1 0.02287 0.12510 0.183 0.85494
ot2:GroupType1:LexiconType1 -0.03474 0.12575 -0.276 0.78233
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) ot1 ot2 GrpTy1 LxcnT1 ot1:GT1 ot2:GT1 o1:LT1 o2:LT1 GT1:LT o1:GT1:
ot1 -0.086
ot2 0.071 -0.372
GroupType1 -0.317 0.000 -0.005
LexiconTyp1 -0.033 0.005 0.001 0.005
ot1:GrpTyp1 -0.177 0.258 0.140 0.416 -0.001
ot2:GrpTyp1 0.153 0.134 0.299 -0.389 0.003 0.024
ot1:LxcnTy1 0.005 -0.095 0.039 0.021 -0.135 0.002 -0.006
ot2:LxcnTy1 -0.001 0.040 -0.080 -0.018 0.115 -0.007 -0.002 -0.374
GrpTyp1:LT1 0.003 0.021 -0.018 -0.052 -0.504 0.008 -0.005 0.000 -0.005
ot1:GT1:LT1 0.000 0.003 -0.007 0.008 -0.281 -0.097 0.016 0.258 0.140 0.416
ot2:GT1:LT1 0.002 -0.005 -0.003 -0.005 0.246 0.016 -0.090 0.133 0.298 -0.389 0.023
summary(CVC_first_order)
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
Family: binomial ( logit )
Formula: New_Redup_B ~ ot1 * GroupType * LexiconType + (1 | Unique_Participant) + (1 | Meaning)
Data: df_director
Control: glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 1e+05))
AIC BIC logLik deviance df.resid
4998.8 5062.5 -2489.4 4978.8 4283
Scaled residuals:
Min 1Q Median 3Q Max
-1.9083 -0.6427 -0.4412 0.8085 5.0362
Random effects:
Groups Name Variance Std.Dev.
Unique_Participant (Intercept) 0.8181 0.9045
Meaning (Intercept) 0.2796 0.5288
Number of obs: 4293, groups: Unique_Participant, 156; Meaning, 18
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.814661 0.158876 -5.128 2.93e-07 ***
ot1 0.524337 0.145977 3.592 0.000328 ***
GroupType1 0.194888 0.077314 2.521 0.011711 *
LexiconType1 -0.020530 0.097939 -0.210 0.833964
ot1:GroupType1 0.304013 0.123888 2.454 0.014130 *
ot1:LexiconType1 -0.277303 0.145879 -1.901 0.057313 .
GroupType1:LexiconType1 0.005124 0.077317 0.066 0.947161
ot1:GroupType1:LexiconType1 0.007622 0.123872 0.062 0.950938
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) ot1 GrpTy1 LxcnT1 ot1:GT1 o1:LT1 GT1:LT
ot1 -0.108
GroupType1 -0.288 0.125
LexiconTyp1 -0.038 0.001 0.018
ot1:GrpTyp1 -0.189 0.355 0.454 -0.005
ot1:LxcnTy1 0.001 -0.095 0.024 -0.172 -0.008
GrpTyp1:LT1 0.012 0.024 -0.080 -0.466 0.018 0.125
ot1:GT1:LT1 -0.003 -0.008 0.018 -0.306 -0.095 0.355 0.454
CVC_model.names <- c("CVC first order","CVC second order","CVC third order")
CVC_summ.table <- do.call(rbind, lapply(list(CVC_first_order,CVC_second_order,CVC_third_order), broom::glance))
CVC_table.cols <- c("df.residual", "deviance", "AIC")
CVC_reported.table <- CVC_summ.table[CVC_table.cols]
names(CVC_reported.table) <- c("Resid.Df", "Resid.Dev", "AIC")
CVC_reported.table[['dAIC']] <- with(CVC_reported.table, AIC - min(AIC))
CVC_reported.table[['AIC_weight']] <- with(CVC_reported.table, exp(- 0.5 * dAIC) / sum(exp(- 0.5 * dAIC)))
CVC_reported.table$AIC <- NULL
CVC_reported.table$AIC_weight <- round(CVC_reported.table$AIC_weight, 2)
CVC_reported.table$dAIC <- round(CVC_reported.table$dAIC, 1)
CVC_reported.table$Resid.Dev <- round(CVC_reported.table$Resid.Dev, 2)
row.names(CVC_reported.table) <- CVC_model.names
Setting row names on a tibble is deprecated.
View(CVC_reported.table)
sjPlot::tab_df(CVC_reported.table,
file="model comparison CVC.doc")
ggplot(df_director, aes(Generation, New_Redup_B, shape=GroupType)) +
stat_summary(fun.data=mean_se, geom="pointrange") +
stat_summary(aes(y=fitted(CVC_first_order), linetype=GroupType),
fun.y=mean, geom="line") +
ylab("Consonant repetition")+
ggtitle('Consonant repetition by group type - first order model')
dev.print(pdf, 'Consonant repetition by group type - first order model.pdf')
quartz_off_screen
2
ggplot(df_director, aes(Generation, New_Redup_B, color=GroupType)) +
stat_summary(fun.data=mean_se, geom="pointrange") +
stat_summary(aes(y=fitted(CVC_second_order), linetype=GroupType),
fun.y=mean, geom="line") +
ylab("CVC repetition")+
ggtitle('CVC repetition by group type - second order model')
dev.print(pdf,'CVC repetition by group type - second order model.pdf')
quartz_off_screen
2
# sjPlot::tab_df(round(coef(summary(CVC_first_order)),3),file='CVC_fixed_effects.doc')
# sjPlot::tab_df(as.numeric(VarCorr(CVC_first_order)),file='CVC_random_effects.doc')
ggplot(df_director, aes(Generation, New_Redup_B, shape=LexiconType)) +
stat_summary(fun.data=mean_se, geom="pointrange") +
stat_summary(aes(y=fitted(CVC_first_order), linetype=LexiconType),
fun.y=mean, geom="line") +
ylab("CVC repetition") +
ggtitle('CVC repetition by lexicon type - first order model')
dev.print(pdf,'CVC repetition by lexicon type - first order model.pdf')
quartz_off_screen
2
ggplot(df_director, aes(Generation, New_Redup_B, shape=LexiconType)) +
stat_summary(fun.data=mean_se, geom="pointrange") +
stat_summary(aes(y=fitted(CVC_second_order), linetype=LexiconType),
fun.y=mean, geom="line") +
ylab("CVC repetition") +
ggtitle('CVC repetition by lexicon type - second order model')
dev.print(pdf,'CVC repetition by lexicon type - second order model.pdf')
quartz_off_screen
2
ggplot(df_director_plot, aes(Generation, Adj_B, group = group_id, colour=GroupType, linetype=LexiconType)) +
stat_summary(fun.data=mean_se, geom="line") +
ylab("Syllable repetition")+
ggtitle('Syllable repetition by group type and lexicon size')
dev.print(pdf, 'Syllable repetition by group type - dog dinner.pdf')
quartz_off_screen
2
# ADJ_third_order <- glmer(Adj_B ~ #maximal random effect structure, up to cubic term
# (ot1+ot2+ot3) * GroupType * LexiconType + (1+ot1+ot2+ot3|Unique_Participant) +
# (1+ot1+ot2+ot3 |Meaning) + (1+ot1+ot2+ot3|Pair), data=df_director, family=binomial,
# control=glmerControl(optimizer = "bobyqa", optCtrl=list(maxfun=1e5)))
# ADJ_second_order <- glmer(Adj_B ~ #maximal random effect structure, up to quadratic term
# (ot1+ot2) * GroupType * LexiconType + (1+ot1+ot2|Unique_Participant) +
# (1+ot1+ot2 |Meaning) + (1+ot1+ot2|Pair),
# data=df_director, family=binomial,
# control=glmerControl(optimizer = "bobyqa", optCtrl=list(maxfun=1e5)))
# ADJ_first_order <- glmer(Adj_B ~ #maximal random effect structure, up to linear term
# ot1 * GroupType * LexiconType + (1+ot1|Unique_Participant) +
# (1+ot1 |Meaning) + (1+ot1|Pair), data=df_director, family=binomial,
# control=glmerControl(optimizer = "bobyqa", optCtrl=list(maxfun=1e5)))
The full models above also result in singular fit. So they are reduced below.
ADJ_third_order <- glmer(Adj_B ~ #maximal random effect structure, up to cubic term
(ot1+ot2+ot3) * GroupType * LexiconType + (1|Unique_Participant) +
(1|Meaning), data=df_director, family=binomial,
control=glmerControl(optimizer = "bobyqa", optCtrl=list(maxfun=1e5)))
ADJ_second_order <- glmer(Adj_B ~ #maximal random effect structure, up to quadratic term
(ot1+ot2) * GroupType * LexiconType + (1|Unique_Participant) +
(1|Meaning), data=df_director, family=binomial,
control=glmerControl(optimizer = "bobyqa", optCtrl=list(maxfun=1e5)))
ADJ_first_order <- glmer(Adj_B ~ #maximal random effect structure, up to linear term
ot1 * GroupType * LexiconType + (1|Unique_Participant) +
(1|Meaning), data=df_director, family=binomial,
control=glmerControl(optimizer = "bobyqa", optCtrl=list(maxfun=1e5)))
summary(ADJ_third_order)
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
Family: binomial ( logit )
Formula: Adj_B ~ (ot1 + ot2 + ot3) * GroupType * LexiconType + (1 | Unique_Participant) + (1 | Meaning)
Data: df_director
Control: glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 1e+05))
AIC BIC logLik deviance df.resid
4218.0 4332.6 -2091.0 4182.0 4275
Scaled residuals:
Min 1Q Median 3Q Max
-1.5872 -0.5279 -0.3722 -0.2213 5.3613
Random effects:
Groups Name Variance Std.Dev.
Unique_Participant (Intercept) 0.9826 0.9913
Meaning (Intercept) 0.2226 0.4718
Number of obs: 4293, groups: Unique_Participant, 156; Meaning, 18
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -1.53427 0.15990 -9.595 < 2e-16 ***
ot1 0.58571 0.20926 2.799 0.00513 **
ot2 -0.04126 0.19946 -0.207 0.83614
ot3 0.00851 0.17095 0.050 0.96030
GroupType1 0.11537 0.09952 1.159 0.24635
LexiconType1 0.05799 0.11335 0.512 0.60896
ot1:GroupType1 0.18242 0.14233 1.282 0.19995
ot2:GroupType1 -0.03445 0.14245 -0.242 0.80890
ot3:GroupType1 -0.10020 0.14278 -0.702 0.48279
ot1:LexiconType1 -0.39684 0.20914 -1.897 0.05777 .
ot2:LexiconType1 0.16562 0.19950 0.830 0.40643
ot3:LexiconType1 0.05031 0.17101 0.294 0.76860
GroupType1:LexiconType1 0.06120 0.09923 0.617 0.53743
ot1:GroupType1:LexiconType1 0.03357 0.14228 0.236 0.81347
ot2:GroupType1:LexiconType1 -0.06016 0.14222 -0.423 0.67230
ot3:GroupType1:LexiconType1 0.06582 0.14275 0.461 0.64475
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation matrix not shown by default, as p = 16 > 12.
Use print(x, correlation=TRUE) or
vcov(x) if you need it
summary(ADJ_second_order)
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
Family: binomial ( logit )
Formula: Adj_B ~ (ot1 + ot2) * GroupType * LexiconType + (1 | Unique_Participant) + (1 | Meaning)
Data: df_director
Control: glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 1e+05))
AIC BIC logLik deviance df.resid
4210.8 4299.9 -2091.4 4182.8 4279
Scaled residuals:
Min 1Q Median 3Q Max
-1.5876 -0.5289 -0.3728 -0.2181 5.3221
Random effects:
Groups Name Variance Std.Dev.
Unique_Participant (Intercept) 0.9814 0.9907
Meaning (Intercept) 0.2225 0.4717
Number of obs: 4293, groups: Unique_Participant, 156; Meaning, 18
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -1.544456 0.158929 -9.718 <2e-16 ***
ot1 0.538404 0.183244 2.938 0.0033 **
ot2 0.001363 0.175009 0.008 0.9938
GroupType1 0.137403 0.094201 1.459 0.1447
LexiconType1 0.064454 0.111876 0.576 0.5645
ot1:GroupType1 0.188905 0.140467 1.345 0.1787
ot2:GroupType1 -0.045908 0.140628 -0.326 0.7441
ot1:LexiconType1 -0.401966 0.183227 -2.194 0.0282 *
ot2:LexiconType1 0.172121 0.174883 0.984 0.3250
GroupType1:LexiconType1 0.055042 0.094117 0.585 0.5587
ot1:GroupType1:LexiconType1 0.036263 0.140436 0.258 0.7962
ot2:GroupType1:LexiconType1 -0.058186 0.140438 -0.414 0.6786
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) ot1 ot2 GrpTy1 LxcnT1 ot1:GT1 ot2:GT1 o1:LT1 o2:LT1 GT1:LT o1:GT1:
ot1 -0.101
ot2 0.079 -0.386
GroupType1 -0.347 -0.006 -0.001
LexiconTyp1 -0.049 0.020 -0.006 0.002
ot1:GrpTyp1 -0.190 0.255 0.133 0.385 -0.002
ot2:GrpTyp1 0.164 0.123 0.303 -0.369 0.011 -0.007
ot1:LxcnTy1 0.015 -0.111 0.050 0.018 -0.143 -0.015 0.004
ot2:LxcnTy1 -0.005 0.049 -0.087 -0.013 0.116 0.001 -0.023 -0.386
GrpTyp1:LT1 0.004 0.019 -0.014 -0.063 -0.498 0.032 -0.024 -0.007 0.001
ot1:GT1:LT1 -0.001 -0.015 0.001 0.031 -0.271 -0.129 0.041 0.254 0.134 0.385
ot2:GT1:LT1 0.007 0.004 -0.023 -0.022 0.239 0.041 -0.112 0.124 0.301 -0.367 -0.006
summary(ADJ_first_order)
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
Family: binomial ( logit )
Formula: Adj_B ~ ot1 * GroupType * LexiconType + (1 | Unique_Participant) + (1 | Meaning)
Data: df_director
Control: glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 1e+05))
AIC BIC logLik deviance df.resid
4204.5 4268.1 -2092.2 4184.5 4283
Scaled residuals:
Min 1Q Median 3Q Max
-1.5938 -0.5306 -0.3726 -0.2207 5.5188
Random effects:
Groups Name Variance Std.Dev.
Unique_Participant (Intercept) 0.9936 0.9968
Meaning (Intercept) 0.2226 0.4718
Number of obs: 4293, groups: Unique_Participant, 156; Meaning, 18
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -1.53490 0.15697 -9.778 < 2e-16 ***
ot1 0.55442 0.16306 3.400 0.000674 ***
GroupType1 0.12145 0.08699 1.396 0.162683
LexiconType1 0.07129 0.10900 0.654 0.513052
ot1:GroupType1 0.18883 0.13927 1.356 0.175154
ot1:LexiconType1 -0.29691 0.16308 -1.821 0.068658 .
GroupType1:LexiconType1 0.02557 0.08697 0.294 0.768723
ot1:GroupType1:LexiconType1 0.01512 0.13924 0.109 0.913533
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) ot1 GrpTy1 LxcnT1 ot1:GT1 o1:LT1 GT1:LT
ot1 -0.125
GroupType1 -0.318 0.114
LexiconTyp1 -0.058 0.012 0.023
ot1:GrpTyp1 -0.201 0.363 0.410 -0.011
ot1:LxcnTy1 0.006 -0.104 0.027 -0.177 -0.035
GrpTyp1:LT1 0.020 0.028 -0.108 -0.464 0.052 0.113
ot1:GT1:LT1 -0.006 -0.035 0.051 -0.292 -0.122 0.363 0.410
ADJ_model.names <- c("ADJ first order","ADJ second order","ADJ third order")
ADJ_summ.table <- do.call(rbind, lapply(list(ADJ_first_order,ADJ_second_order,ADJ_third_order), broom::glance))
ADJ_table.cols <- c("df.residual", "deviance", "AIC")
ADJ_reported.table <- ADJ_summ.table[ADJ_table.cols]
names(ADJ_reported.table) <- c("Resid.Df", "Resid.Dev", "AIC")
ADJ_reported.table[['dAIC']] <- with(ADJ_reported.table, AIC - min(AIC))
ADJ_reported.table[['AIC_weight']] <- with(ADJ_reported.table, exp(- 0.5 * dAIC) / sum(exp(- 0.5 * dAIC)))
ADJ_reported.table$AIC <- NULL
ADJ_reported.table$AIC_weight <- round(ADJ_reported.table$AIC_weight, 2)
ADJ_reported.table$dAIC <- round(ADJ_reported.table$dAIC, 1)
ADJ_reported.table$Resid.Dev <- round(ADJ_reported.table$Resid.Dev, 2)
row.names(ADJ_reported.table) <- ADJ_model.names
Setting row names on a tibble is deprecated.
View(ADJ_reported.table)
sjPlot::tab_df(ADJ_reported.table,
file="model comparison _ADJ.doc")
sjPlot::tab_df(round(coef(summary(ADJ_first_order)),3),file='ADJ_fixed_effects.doc')
df_director_adj_plots <- subset(df_director, !(is.na(df_director$Adj_B)))
ggplot(df_director_adj_plots, aes(Generation, Adj_B, shape=GroupType)) +
stat_summary(fun.data=mean_se, geom="pointrange") +
stat_summary(aes(y=fitted(ADJ_first_order), linetype=GroupType),
fun.y=mean, geom="line") +
ylab("Adjacent repetition")+
ggtitle('Adjacent repetition by group type - first order model')
dev.print(pdf,'Adjacent repetition by group type - first order model.pdf')
quartz_off_screen
2
ggplot(df_director_adj_plots, aes(Generation, Adj_B, color=GroupType)) +
stat_summary(fun.data=mean_se, geom="pointrange") +
stat_summary(aes(y=fitted(ADJ_second_order), linetype=GroupType),
fun.y=mean, geom="line") +
ylab("Adjacent Repetition") +
ggtitle('Adjacent repetition by group type - second order model')
dev.print(pdf,'Adjacent repetition by group type - second order model.pdf')
quartz_off_screen
2
ggplot(df_director_adj_plots, aes(Generation, Adj_B, color=LexiconType)) +
stat_summary(fun.data=mean_se, geom="pointrange") +
stat_summary(aes(y=fitted(ADJ_first_order), linetype=LexiconType),
fun.y=mean, geom="line") +
ylab("Adjacent repetition")+
ggtitle('Adjacent repetition by lexicon type - first order model')
dev.print(pdf,'Adjacent repetition by lexicon type - first order model.pdf')
quartz_off_screen
2
ggplot(df_director_adj_plots, aes(Generation, Adj_B, color=LexiconType)) +
stat_summary(fun.data=mean_se, geom="pointrange") +
stat_summary(aes(y=fitted(ADJ_second_order), linetype=LexiconType),
fun.y=mean, geom="line") +
ylab("Adjacent repetition")+
ggtitle('Adjacent repetition by lexicon type - second order model')
dev.print(pdf,'Adjacent repetition by lexicon type - second order model.pdf')
quartz_off_screen
2
groups2 = ddply(df_matcher, c("GroupType", "LexiconType", "GroupNumber"), summarise, n=length(Block))
groups2$group_id = factor(LETTERS[1:24])
df_matcher_plot = merge(df_matcher, groups, all.x = TRUE)
ggplot(df_matcher_plot, aes(Generation, Score, group = group_id, colour=GroupType, linetype=LexiconType)) +
stat_summary(fun.data=mean_se, geom="line") +
ylab("Accuracy")+
ggtitle('Accuracy group type and lexicon size')
dev.print(pdf, 'Accuracy by group type - dog dinner.pdf')
quartz_off_screen
2
#ACC_first_order <- glmer(Score ~ #maximal random effect structure, up to linear term
# ot1 * GroupType * LexiconType + (1+ot1|Unique_Participant) +
# (1+ot1 |Meaning) + (1+ot1|Pair), data=df_matcher, family=binomial,
# control=glmerControl(optimizer = "bobyqa", optCtrl=list(maxfun=1e5)))
#ACC_second_order <- glmer(Score ~ #maximal random effect structure, up to quadratic term
# (ot1+ot2) * GroupType * LexiconType + (1+ot1+ot2|Unique_Participant) +
# (1+ot1+ot2 |Meaning) + (1+ot1+ot2|Pair), data=df_matcher, family=binomial,
# control=glmerControl(optimizer = "bobyqa", optCtrl=list(maxfun=1e5)))
#ACC_third_order <- glmer(Score ~ #maximal random effect structure, up to cubic term
# (ot1+ot2+ot3) * GroupType * LexiconType + (1+ot1+ot2+ot3|Unique_Participant) +
# (1+ot1+ot2+ot3 |Meaning) + (1+ot1+ot2+ot3|Pair), data=df_matcher, family=binomial,
# control=glmerControl(optimizer = "bobyqa", optCtrl=list(maxfun=1e5)))
The full models above also result in singular fit. So they are reduced below.
ACC_first_order <- glmer(Score ~ #maximal random effect structure, up to linear term
ot1 * GroupType * LexiconType + (1|Unique_Participant) + (1|Meaning),
data=df_matcher, family=binomial,
control=glmerControl(optimizer = "bobyqa", optCtrl=list(maxfun=1e5)))
ACC_second_order <- glmer(Score ~ #maximal random effect structure, up to quadratic term
(ot1+ot2) * GroupType * LexiconType + (1|Unique_Participant) + (1|Meaning),
data=df_matcher, family=binomial,
control=glmerControl(optimizer = "bobyqa", optCtrl=list(maxfun=1e5)))
ACC_third_order <- glmer(Score ~ #maximal random effect structure, up to cubic term
(ot1+ot2+ot3) * GroupType * LexiconType + (1|Unique_Participant) + (1|Meaning),
data=df_matcher, family=binomial,
control=glmerControl(optimizer = "bobyqa", optCtrl=list(maxfun=1e5)))
summary(ACC_third_order)
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
Family: binomial ( logit )
Formula: Score ~ (ot1 + ot2 + ot3) * GroupType * LexiconType + (1 | Unique_Participant) + (1 | Meaning)
Data: df_matcher
Control: glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 1e+05))
AIC BIC logLik deviance df.resid
4070.5 4181.9 -2017.3 4034.5 3575
Scaled residuals:
Min 1Q Median 3Q Max
-6.1190 -0.9143 0.4321 0.6505 1.5580
Random effects:
Groups Name Variance Std.Dev.
Unique_Participant (Intercept) 0.55055 0.7420
Meaning (Intercept) 0.03745 0.1935
Number of obs: 3593, groups: Unique_Participant, 144; Meaning, 18
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 1.10906 0.10614 10.449 < 2e-16 ***
ot1 0.88270 0.12588 7.012 2.35e-12 ***
ot2 -0.09864 0.12379 -0.797 0.425558
ot3 0.10352 0.12181 0.850 0.395405
GroupType1 -0.31792 0.09418 -3.376 0.000736 ***
LexiconType1 -0.32208 0.09513 -3.386 0.000710 ***
ot1:GroupType1 -0.28119 0.12573 -2.236 0.025322 *
ot2:GroupType1 -0.11101 0.12379 -0.897 0.369854
ot3:GroupType1 -0.04318 0.12180 -0.355 0.722946
ot1:LexiconType1 -0.31164 0.12576 -2.478 0.013209 *
ot2:LexiconType1 -0.07789 0.12379 -0.629 0.529213
ot3:LexiconType1 0.06388 0.12182 0.524 0.600049
GroupType1:LexiconType1 0.08920 0.09413 0.948 0.343319
ot1:GroupType1:LexiconType1 0.02448 0.12572 0.195 0.845639
ot2:GroupType1:LexiconType1 0.12381 0.12379 1.000 0.317238
ot3:GroupType1:LexiconType1 0.16946 0.12183 1.391 0.164259
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation matrix not shown by default, as p = 16 > 12.
Use print(x, correlation=TRUE) or
vcov(x) if you need it
summary(ACC_second_order)
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
Family: binomial ( logit )
Formula: Score ~ (ot1 + ot2) * GroupType * LexiconType + (1 | Unique_Participant) + (1 | Meaning)
Data: df_matcher
Control: glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 1e+05))
AIC BIC logLik deviance df.resid
4065.3 4151.9 -2018.7 4037.3 3579
Scaled residuals:
Min 1Q Median 3Q Max
-5.6764 -0.9113 0.4319 0.6498 1.6065
Random effects:
Groups Name Variance Std.Dev.
Unique_Participant (Intercept) 0.55588 0.7456
Meaning (Intercept) 0.03741 0.1934
Number of obs: 3593, groups: Unique_Participant, 144; Meaning, 18
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 1.10628 0.10634 10.403 < 2e-16 ***
ot1 0.87276 0.12473 6.997 2.61e-12 ***
ot2 -0.11617 0.12191 -0.953 0.340617
GroupType1 -0.31668 0.09441 -3.354 0.000796 ***
LexiconType1 -0.32036 0.09537 -3.359 0.000781 ***
ot1:GroupType1 -0.27350 0.12458 -2.195 0.028134 *
ot2:GroupType1 -0.08912 0.12190 -0.731 0.464743
ot1:LexiconType1 -0.30254 0.12461 -2.428 0.015183 *
ot2:LexiconType1 -0.06219 0.12190 -0.510 0.609955
GroupType1:LexiconType1 0.08662 0.09437 0.918 0.358681
ot1:GroupType1:LexiconType1 0.01577 0.12457 0.127 0.899269
ot2:GroupType1:LexiconType1 0.10388 0.12190 0.852 0.394120
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) ot1 ot2 GrpTy1 LxcnT1 ot1:GT1 ot2:GT1 o1:LT1 o2:LT1 GT1:LT o1:GT1:
ot1 0.080
ot2 0.015 0.112
GroupType1 -0.499 -0.055 -0.021
LexiconTyp1 -0.093 -0.067 -0.017 0.034
ot1:GrpTyp1 -0.049 0.245 -0.072 0.084 0.041
ot2:GrpTyp1 -0.019 -0.072 0.296 0.018 0.023 0.113
ot1:LxcnTy1 -0.060 -0.234 -0.082 0.041 0.083 0.112 0.063
ot2:LxcnTy1 -0.015 -0.082 -0.202 0.024 0.018 0.063 0.079 0.112
GrpTyp1:LT1 0.031 0.042 0.023 -0.079 -0.559 -0.065 -0.018 -0.056 -0.021
ot1:GT1:LT1 0.035 0.111 0.063 -0.065 -0.055 -0.234 -0.082 0.245 -0.072 0.083
ot2:GT1:LT1 0.022 0.063 0.079 -0.018 -0.021 -0.082 -0.202 -0.072 0.296 0.019 0.112
summary(ACC_first_order)
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
Family: binomial ( logit )
Formula: Score ~ ot1 * GroupType * LexiconType + (1 | Unique_Participant) + (1 | Meaning)
Data: df_matcher
Control: glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 1e+05))
AIC BIC logLik deviance df.resid
4060.2 4122.1 -2020.1 4040.2 3583
Scaled residuals:
Min 1Q Median 3Q Max
-5.3773 -0.9108 0.4328 0.6502 1.6203
Random effects:
Groups Name Variance Std.Dev.
Unique_Participant (Intercept) 0.56201 0.7497
Meaning (Intercept) 0.03734 0.1932
Number of obs: 3593, groups: Unique_Participant, 144; Meaning, 18
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 1.105108 0.106587 10.368 < 2e-16 ***
ot1 0.870556 0.123001 7.078 1.47e-12 ***
GroupType1 -0.314923 0.094714 -3.325 0.000884 ***
LexiconType1 -0.318162 0.095662 -3.326 0.000881 ***
ot1:GroupType1 -0.263141 0.122847 -2.142 0.032192 *
ot1:LexiconType1 -0.288397 0.122878 -2.347 0.018924 *
GroupType1:LexiconType1 0.084818 0.094668 0.896 0.370279
ot1:GroupType1:LexiconType1 -0.003059 0.122841 -0.025 0.980136
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) ot1 GrpTy1 LxcnT1 ot1:GT1 o1:LT1 GT1:LT
ot1 0.074
GroupType1 -0.500 -0.046
LexiconTyp1 -0.090 -0.058 0.031
ot1:GrpTyp1 -0.041 0.293 0.077 0.030
ot1:LxcnTy1 -0.052 -0.204 0.030 0.077 0.075
GrpTyp1:LT1 0.029 0.031 -0.077 -0.559 -0.056 -0.047
ot1:GT1:LT1 0.026 0.074 -0.056 -0.046 -0.203 0.293 0.076
ACC_model.names <- c("ACC first order","ACC second order","ACC third order")
ACC_summ.table <- do.call(rbind, lapply(list(ACC_first_order,ACC_second_order,ACC_third_order), broom::glance))
ACC_table.cols <- c("df.residual", "deviance", "AIC")
ACC_reported.table <- ACC_summ.table[ACC_table.cols]
names(ACC_reported.table) <- c("Resid.Df", "Resid.Dev", "AIC")
ACC_reported.table[['dAIC']] <- with(ACC_reported.table, AIC - min(AIC))
ACC_reported.table[['AIC_weight']] <- with(ACC_reported.table, exp(- 0.5 * dAIC) / sum(exp(- 0.5 * dAIC)))
ACC_reported.table$AIC <- NULL
ACC_reported.table$dAIC <- round(ACC_reported.table$dAIC, 1)
ACC_reported.table$AIC_weight <- round(ACC_reported.table$AIC_weight, 2)
ACC_reported.table$Resid.Dev <- round(ACC_reported.table$Resid.Dev, 2)
row.names(ACC_reported.table) <- ACC_model.names
Setting row names on a tibble is deprecated.
View(ACC_reported.table)
sjPlot::tab_df(ACC_reported.table,
file="model comparison _ACC.doc")
ggplot(df_matcher, aes(Generation, Score, shape=GroupType)) +
stat_summary(fun.data=mean_se, geom="pointrange") +
stat_summary(aes(y=fitted(ACC_first_order), linetype=GroupType),
fun.y=mean, geom="line") +
ylab("Accuracy")+
ggtitle('Accuracy by group type - first order model')
dev.print(pdf,'Accuracy by group type - first order model.pdf')
quartz_off_screen
2
ggplot(df_matcher, aes(Generation, Score, color=GroupType)) +
stat_summary(fun.data=mean_se, geom="pointrange") +
stat_summary(aes(y=fitted(ACC_second_order), linetype=GroupType),
fun.y=mean, geom="line") +
ylab("Accuracy")+
ggtitle('Accuracy by group type - second order model')
dev.print(pdf,'Accuracy by group type - second order model.pdf')
quartz_off_screen
2
ggplot(df_matcher, aes(Generation, Score, shape=LexiconType)) +
stat_summary(fun.data=mean_se, geom="pointrange") +
stat_summary(aes(y=fitted(ACC_first_order), linetype=LexiconType),
fun.y=mean, geom="line") +
ylab("Accuracy")+
ggtitle('Accuracy by lexicon type - first order model')
dev.print(pdf,'Accuracy by lexicon type - first order model.pdf')
quartz_off_screen
2
ggplot(df_matcher, aes(Generation, Score, shape=LexiconType)) +
stat_summary(fun.data=mean_se, geom="pointrange") +
stat_summary(aes(y=fitted(ACC_second_order), linetype=LexiconType),
fun.y=mean, geom="line") +
ylab("Accuracy")+
ggtitle('Accuracy by lexicon type - second order model')
dev.print(pdf,'Accuracy by lexicon type - second order model.pdf')
quartz_off_screen
2
sjPlot::tab_df(round(coef(summary(ACC_first_order)),3),file='ACC_fixed_effects.doc')
These are based on iteration 2 only. Homonymy is calculated as proportions.
df_homonymy<-setNames(aggregate(df_director_generations_1_to_5$New_Redup_B, by=list(df_director_generations_1_to_5$GroupType,df_director_generations_1_to_5$LexiconType,df_director_generations_1_to_5$GroupNumber,df_director_generations_1_to_5$Generation,df_director_generations_1_to_5$Unique_language,df_director_generations_1_to_5$Pair, df_director_generations_1_to_5$Unique_Participant), FUN=mean),c('GroupType','LexiconType','GroupNumber','Generation','Unique_language','Pair', 'Unique_Participant','New_Redup_B_mean'))
df_homonymy$Word_repetition<-NA
for(i in unique(df_homonymy$Unique_language)){
subs_ <- subset(df_director_generations_1_to_5,Unique_language==i)
for(j in 1:nrow(df_homonymy)){
if(toString(df_homonymy[j,]$Unique_language) == i){
df_homonymy[j,]$Word_repetition <- (length(subs_$TypedLabel)-length(unique(subs_$TypedLabel)))/length(subs_$TypedLabel)
}
}
}
initial_languages<-subset(df_director,Generation==0)
df_initial_languages <-setNames(aggregate(initial_languages$New_Redup_B, by=list(initial_languages$GroupType,initial_languages$LexiconType,initial_languages$GroupNumber,initial_languages$Generation,initial_languages$Unique_language,initial_languages$Pair, initial_languages$Unique_Participant), FUN=mean),c('GroupType','LexiconType','GroupNumber','Generation','Unique_language','Pair', 'Unique_Participant','New_Redup_B_mean'))
df_initial_languages$Word_repetition <-0
df_homonymy<-rbind(df_initial_languages,df_homonymy)
df_homonymy_1_to_5 <- subset(df_homonymy, Generation>0) #generations 1 to 5
cor(df_homonymy_1_to_5$New_Redup_B_mean,df_homonymy_1_to_5$Word_repetition) #looking at mean CVC redup. When looking at sum CVC redup the correlation was .20...
[1] 0.176133
df_homonymy$timebin = df_homonymy$Generation + 1
t_ = poly(unique(df_homonymy$timebin), 3)
df_homonymy[,paste("ot", 1:3, sep="")] <- t_[df_homonymy$timebin, 1:3]
contrasts(df_homonymy$LexiconType) = contr.sum(2)
contrasts(df_homonymy$GroupType) = contr.sum(2)
Can’t fit a 3rd order model because there are fewer observations than random effects
homonymy_first_order <- lmer(Word_repetition ~
ot1*GroupType*LexiconType +
(1|Unique_Participant),
data=df_homonymy, control=lmerControl(optimizer = "bobyqa", optCtrl=list(maxfun=2e5)))
homonymy_second_order <- lmer(Word_repetition ~
(ot1+ot2)*GroupType*LexiconType +
(1|Unique_Participant),
data=df_homonymy, control=lmerControl(optimizer = "bobyqa", optCtrl=list(maxfun=2e5)))
summary(homonymy_first_order)
Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
Formula: Word_repetition ~ ot1 * GroupType * LexiconType + (1 | Unique_Participant)
Data: df_homonymy
Control: lmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 2e+05))
REML criterion at convergence: -718.7
Scaled residuals:
Min 1Q Median 3Q Max
-2.66121 -0.35552 -0.06661 0.27156 2.99173
Random effects:
Groups Name Variance Std.Dev.
Unique_Participant (Intercept) 0.006034 0.07768
Residual 0.001311 0.03621
Number of obs: 288, groups: Unique_Participant, 156
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 6.252e-02 7.815e-03 1.326e+02 8.000 5.47e-13 ***
ot1 3.912e-02 1.036e-02 2.659e+02 3.776 0.000196 ***
GroupType1 3.999e-02 5.768e-03 2.219e+02 6.933 4.44e-11 ***
LexiconType1 3.035e-03 7.815e-03 1.326e+02 0.388 0.698384
ot1:GroupType1 6.701e-02 9.056e-03 2.242e+02 7.400 2.72e-12 ***
ot1:LexiconType1 3.169e-02 1.036e-02 2.659e+02 3.059 0.002445 **
GroupType1:LexiconType1 3.654e-04 5.768e-03 2.219e+02 0.063 0.949542
ot1:GroupType1:LexiconType1 -1.794e-03 9.056e-03 2.242e+02 -0.198 0.843179
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) ot1 GrpTy1 LxcnT1 ot1:GT1 o1:LT1 GT1:LT
ot1 -0.254
GroupType1 -0.494 0.321
LexiconTyp1 0.000 0.000 0.000
ot1:GrpTyp1 -0.384 0.542 0.628 0.000
ot1:LxcnTy1 0.000 0.000 0.000 -0.254 0.000
GrpTyp1:LT1 0.000 0.000 0.000 -0.494 0.000 0.321
ot1:GT1:LT1 0.000 0.000 0.000 -0.384 0.000 0.542 0.628
summary(homonymy_second_order)
Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
Formula: Word_repetition ~ (ot1 + ot2) * GroupType * LexiconType + (1 | Unique_Participant)
Data: df_homonymy
Control: lmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 2e+05))
REML criterion at convergence: -689.3
Scaled residuals:
Min 1Q Median 3Q Max
-2.59096 -0.35469 -0.04545 0.26614 2.92943
Random effects:
Groups Name Variance Std.Dev.
Unique_Participant (Intercept) 0.006162 0.07850
Residual 0.001319 0.03632
Number of obs: 288, groups: Unique_Participant, 156
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 6.186e-02 8.292e-03 1.180e+02 7.459 1.61e-11 ***
ot1 3.810e-02 1.172e-02 2.670e+02 3.252 0.00129 **
ot2 -4.644e-04 1.139e-02 2.617e+02 -0.041 0.96750
GroupType1 4.095e-02 6.669e-03 1.641e+02 6.140 6.00e-09 ***
LexiconType1 2.533e-03 8.292e-03 1.180e+02 0.306 0.76052
ot1:GroupType1 6.697e-02 9.236e-03 2.191e+02 7.252 7.00e-12 ***
ot2:GroupType1 -2.572e-03 9.293e-03 2.162e+02 -0.277 0.78224
ot1:LexiconType1 3.407e-02 1.172e-02 2.670e+02 2.907 0.00395 **
ot2:LexiconType1 -5.874e-03 1.139e-02 2.617e+02 -0.516 0.60647
GroupType1:LexiconType1 4.063e-04 6.669e-03 1.641e+02 0.061 0.95149
ot1:GroupType1:LexiconType1 -2.523e-03 9.236e-03 2.191e+02 -0.273 0.78500
ot2:GroupType1:LexiconType1 -1.263e-03 9.293e-03 2.162e+02 -0.136 0.89204
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) ot1 ot2 GrpTy1 LxcnT1 ot1:GT1 ot2:GT1 o1:LT1 o2:LT1 GT1:LT o1:GT1:
ot1 -0.189
ot2 0.178 -0.312
GroupType1 -0.551 0.135 -0.127
LexiconTyp1 0.000 0.000 0.000 0.000
ot1:GrpTyp1 -0.336 0.432 0.152 0.526 0.000
ot2:GrpTyp1 0.305 0.146 0.469 -0.477 0.000 0.068
ot1:LxcnTy1 0.000 0.000 0.000 0.000 -0.189 0.000 0.000
ot2:LxcnTy1 0.000 0.000 0.000 0.000 0.178 0.000 0.000 -0.312
GrpTyp1:LT1 0.000 0.000 0.000 0.000 -0.551 0.000 0.000 0.135 -0.127
ot1:GT1:LT1 0.000 0.000 0.000 0.000 -0.336 0.000 0.000 0.432 0.152 0.526
ot2:GT1:LT1 0.000 0.000 0.000 0.000 0.305 0.000 0.000 0.146 0.469 -0.477 0.068
homonyms_model.names <- c("Homonymy first order","Homonymy second order")
homonyms_summ.table <- do.call(rbind, lapply(list(homonymy_first_order,homonymy_second_order), broom::glance))
homonyms_table.cols <- c("df.residual", "deviance", "AIC")
homonyms_reported.table <- homonyms_summ.table[homonyms_table.cols]
names(homonyms_reported.table) <- c("Resid. Df", "Resid.Dev", "AIC")
homonyms_reported.table[['dAIC']] <- with(homonyms_reported.table, AIC - min(AIC))
homonyms_reported.table[['AIC_weight']] <- with(homonyms_reported.table, exp(- 0.5 * dAIC) / sum(exp(- 0.5 * dAIC)))
homonyms_reported.table$AIC <- NULL
homonyms_reported.table$AIC_weight <- round(homonyms_reported.table$AIC_weight, 2)
homonyms_reported.table$dAIC <- round(homonyms_reported.table$dAIC, 1)
homonyms_reported.table$Resid.Dev <- round(homonyms_reported.table$Resid.Dev, 2)
row.names(homonyms_reported.table) <- homonyms_model.names
Setting row names on a tibble is deprecated.
View(homonyms_reported.table)
anova(homonymy_first_order,homonymy_second_order)
refitting model(s) with ML (instead of REML)
Data: df_homonymy
Models:
homonymy_first_order: Word_repetition ~ ot1 * GroupType * LexiconType + (1 | Unique_Participant)
homonymy_second_order: Word_repetition ~ (ot1 + ot2) * GroupType * LexiconType + (1 |
homonymy_second_order: Unique_Participant)
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
homonymy_first_order 10 -763.57 -726.94 391.79 -783.57
homonymy_second_order 14 -755.95 -704.67 391.97 -783.95 0.3756 4 0.9844
sjPlot::tab_df(homonyms_reported.table,
file="model comparison homonyms_.doc")
sjPlot::tab_df(round(coef(summary(homonymy_first_order)),3),file='homonyms_fixed_effects.doc')
ggplot(df_homonymy, aes(Generation, Word_repetition, shape=GroupType)) +
stat_summary(fun.data=mean_se, geom="pointrange") +
stat_summary(aes(y=fitted(homonymy_first_order), linetype=GroupType),
fun.y=mean, geom="line") +
ylab("Proportion of homonymy")
dev.print(pdf,'Homonymy by group type - first order model.pdf')
quartz_off_screen
2
ggplot(df_homonymy, aes(Generation, Word_repetition, color=GroupType)) +
stat_summary(fun.data=mean_se, geom="pointrange") +
stat_summary(aes(y=fitted(homonymy_second_order), linetype=GroupType),
fun.y=mean, geom="line") +
ylab("Proportion of homonymy")
dev.print(pdf,'Homonymy by group type - second order model.pdf')
quartz_off_screen
2
ggplot(df_homonymy, aes(Generation, Word_repetition, shape=LexiconType)) +
stat_summary(fun.data=mean_se, geom="pointrange") +
stat_summary(aes(y=fitted(homonymy_first_order), linetype=LexiconType),
fun.y=mean, geom="line") +
ylab("Proportion of homonymy")
dev.print(pdf,'Homonymy by lexicon type - first order model.pdf')
quartz_off_screen
2
ggplot(df_homonymy, aes(Generation, Word_repetition, color=LexiconType)) +
stat_summary(fun.data=mean_se, geom="pointrange") +
stat_summary(aes(y=fitted(homonymy_second_order), linetype=LexiconType),
fun.y=mean, geom="line") +
ylab("Proportion of homonymy")
dev.print(pdf,'Homonymy by lexicon type - second order model.pdf')
quartz_off_screen
2
Analyze homonymy again, using 0/1 coding for word repetition and binomial stats
df_homonymy$Word_repetition_binary = ifelse(df_homonymy$Word_repetition > 0, 1, 0)
homonymy_first_order_log <- glmer(Word_repetition_binary ~
ot1*GroupType*LexiconType + (1|Unique_Participant),
data=df_homonymy, family=binomial,
control=glmerControl(optimizer = "bobyqa", optCtrl=list(maxfun=1e5)))
homonymy_second_order_log <- glmer(Word_repetition_binary ~
(ot1+ot2)*GroupType*LexiconType + (1|Unique_Participant),
data=df_homonymy, family=binomial,
control=glmerControl(optimizer = "bobyqa", optCtrl=list(maxfun=1e5)))
homonymy_third_order_log <- glmer(Word_repetition_binary ~
(ot1+ot2+ot3)*GroupType*LexiconType + (1|Unique_Participant),
data=df_homonymy, family=binomial,
control=glmerControl(optimizer = "bobyqa", optCtrl=list(maxfun=1e5)))
summary(homonymy_first_order_log)
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
Family: binomial ( logit )
Formula: Word_repetition_binary ~ ot1 * GroupType * LexiconType + (1 | Unique_Participant)
Data: df_homonymy
Control: glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 1e+05))
AIC BIC logLik deviance df.resid
305.7 338.7 -143.9 287.7 279
Scaled residuals:
Min 1Q Median 3Q Max
-2.3399 -0.4370 -0.1921 0.3336 2.0135
Random effects:
Groups Name Variance Std.Dev.
Unique_Participant (Intercept) 3.286 1.813
Number of obs: 288, groups: Unique_Participant, 156
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.16379 0.26493 -0.618 0.536432
ot1 1.69728 0.57580 2.948 0.003201 **
GroupType1 1.58281 0.43196 3.664 0.000248 ***
LexiconType1 0.23858 0.28474 0.838 0.402103
ot1:GroupType1 2.67830 0.77586 3.452 0.000556 ***
ot1:LexiconType1 0.27372 0.58093 0.471 0.637519
GroupType1:LexiconType1 -0.03297 0.25705 -0.128 0.897942
ot1:GroupType1:LexiconType1 -1.36152 0.59300 -2.296 0.021676 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) ot1 GrpTy1 LxcnT1 ot1:GT1 o1:LT1 GT1:LT
ot1 0.048
GroupType1 -0.121 0.081
LexiconTyp1 -0.007 -0.049 0.287
ot1:GrpTyp1 0.008 0.230 0.670 0.307
ot1:LxcnTy1 -0.073 -0.163 0.154 0.096 0.063
GrpTyp1:LT1 -0.029 0.044 -0.157 -0.305 -0.182 0.014
ot1:GT1:LT1 0.033 -0.093 -0.411 -0.195 -0.438 0.164 0.248
summary(homonymy_second_order_log)
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
Family: binomial ( logit )
Formula: Word_repetition_binary ~ (ot1 + ot2) * GroupType * LexiconType + (1 | Unique_Participant)
Data: df_homonymy
Control: glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 1e+05))
AIC BIC logLik deviance df.resid
298.8 346.5 -136.4 272.8 275
Scaled residuals:
Min 1Q Median 3Q Max
-2.4415 -0.4328 -0.1880 0.3536 3.5588
Random effects:
Groups Name Variance Std.Dev.
Unique_Participant (Intercept) 1.361 1.167
Number of obs: 288, groups: Unique_Participant, 156
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.31709 0.22011 -1.441 0.149696
ot1 1.83969 0.53858 3.416 0.000636 ***
ot2 -1.84158 0.52716 -3.493 0.000477 ***
GroupType1 1.26953 0.28193 4.503 6.7e-06 ***
LexiconType1 0.20317 0.22319 0.910 0.362680
ot1:GroupType1 2.18125 0.60706 3.593 0.000327 ***
ot2:GroupType1 -0.14429 0.49813 -0.290 0.772074
ot1:LexiconType1 0.35009 0.52733 0.664 0.506759
ot2:LexiconType1 0.09551 0.51961 0.184 0.854155
GroupType1:LexiconType1 0.01316 0.21285 0.062 0.950700
ot1:GroupType1:LexiconType1 -1.30560 0.52323 -2.495 0.012585 *
ot2:GroupType1:LexiconType1 -0.68910 0.49401 -1.395 0.163042
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) ot1 ot2 GrpTy1 LxcnT1 ot1:GT1 ot2:GT1 o1:LT1 o2:LT1 GT1:LT o1:GT1:
ot1 0.010
ot2 0.265 -0.162
GroupType1 -0.183 0.098 -0.139
LexiconTyp1 -0.112 -0.098 -0.184 0.132
ot1:GrpTyp1 -0.108 0.132 -0.173 0.437 0.215
ot2:GrpTyp1 -0.007 -0.125 0.083 0.023 -0.048 -0.130
ot1:LxcnTy1 -0.146 -0.151 -0.149 0.136 0.038 0.031 0.135
ot2:LxcnTy1 -0.157 -0.139 -0.180 -0.016 0.251 0.131 0.036 -0.131
GrpTyp1:LT1 0.018 0.122 -0.014 -0.094 -0.177 -0.142 -0.154 -0.057 -0.038
ot1:GT1:LT1 0.154 -0.059 0.198 -0.291 -0.124 -0.320 -0.094 0.001 -0.092 0.114
ot2:GT1:LT1 -0.005 0.117 0.057 -0.204 -0.044 -0.195 -0.162 -0.097 0.054 0.191 0.000
summary(homonymy_third_order_log)
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
Family: binomial ( logit )
Formula: Word_repetition_binary ~ (ot1 + ot2 + ot3) * GroupType * LexiconType + (1 | Unique_Participant)
Data: df_homonymy
Control: glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 1e+05))
AIC BIC logLik deviance df.resid
293.0 355.3 -129.5 259.0 271
Scaled residuals:
Min 1Q Median 3Q Max
-2.7747 -0.4301 -0.1310 0.3791 2.0874
Random effects:
Groups Name Variance Std.Dev.
Unique_Participant (Intercept) 1.301 1.141
Number of obs: 288, groups: Unique_Participant, 156
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.440247 0.238064 -1.849 0.064417 .
ot1 2.573285 0.662650 3.883 0.000103 ***
ot2 -2.181392 0.622676 -3.503 0.000460 ***
ot3 1.592944 0.526002 3.028 0.002459 **
GroupType1 1.232435 0.284710 4.329 1.5e-05 ***
LexiconType1 0.169306 0.239656 0.706 0.479905
ot1:GroupType1 1.920450 0.677763 2.834 0.004604 **
ot2:GroupType1 -0.116931 0.570672 -0.205 0.837649
ot3:GroupType1 -0.227157 0.499726 -0.455 0.649423
ot1:LexiconType1 0.183170 0.631328 0.290 0.771714
ot2:LexiconType1 -0.041502 0.589329 -0.070 0.943857
ot3:LexiconType1 -0.059721 0.513425 -0.116 0.907400
GroupType1:LexiconType1 -0.005999 0.231297 -0.026 0.979308
ot1:GroupType1:LexiconType1 -1.041604 0.619715 -1.681 0.092806 .
ot2:GroupType1:LexiconType1 -0.657437 0.570436 -1.153 0.249109
ot3:GroupType1:LexiconType1 0.787134 0.512633 1.535 0.124667
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation matrix not shown by default, as p = 16 > 12.
Use print(x, correlation=TRUE) or
vcov(x) if you need it
numcols <- grep("^c\\.",names(df_homonymy))
dfs_homonymy <- df_homonymy
dfs_homonymy[,numcols] <- scale(dfs_homonymy[,numcols])
homonymy_first_order_log_sc <- update(homonymy_first_order_log, data=dfs_homonymy)
homonymy_second_order_log_sc <- update(homonymy_second_order_log, data=dfs_homonymy)
Model comparison shows that the second-order model has the best fit.
homonyms_log_model.names <- c("Homonymy first order log","Homonymy second order log", "Homonymy third order log")
homonyms_log_summ.table <- do.call(rbind, lapply(list(homonymy_first_order_log,homonymy_second_order, homonymy_third_order_log), broom::glance))
homonyms_log_table.cols <- c("df.residual", "deviance", "AIC")
homonyms_log_reported.table <- homonyms_log_summ.table[homonyms_log_table.cols]
names(homonyms_log_reported.table) <- c("Resid. Df", "Resid.Dev", "AIC")
homonyms_log_reported.table[['dAIC']] <- with(homonyms_log_reported.table, AIC - min(AIC))
homonyms_log_reported.table[['AIC_weight']] <- with(homonyms_log_reported.table, exp(- 0.5 * dAIC) / sum(exp(- 0.5 * dAIC)))
homonyms_log_reported.table$AIC <- NULL
homonyms_log_reported.table$AIC_weight <- round(homonyms_log_reported.table$AIC_weight, 2)
homonyms_log_reported.table$dAIC <- round(homonyms_log_reported.table$dAIC, 1)
homonyms_log_reported.table$Resid.Dev <- round(homonyms_log_reported.table$Resid.Dev, 2)
row.names(homonyms_log_reported.table) <- homonyms_log_model.names
Setting row names on a tibble is deprecated.
View(homonyms_log_reported.table)
anova(homonymy_first_order_log,homonymy_second_order_log, homonymy_third_order_log)
Data: df_homonymy
Models:
homonymy_first_order_log: Word_repetition_binary ~ ot1 * GroupType * LexiconType + (1 |
homonymy_first_order_log: Unique_Participant)
homonymy_second_order_log: Word_repetition_binary ~ (ot1 + ot2) * GroupType * LexiconType +
homonymy_second_order_log: (1 | Unique_Participant)
homonymy_third_order_log: Word_repetition_binary ~ (ot1 + ot2 + ot3) * GroupType * LexiconType +
homonymy_third_order_log: (1 | Unique_Participant)
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
homonymy_first_order_log 9 305.75 338.72 -143.88 287.75
homonymy_second_order_log 13 298.84 346.46 -136.42 272.84 14.912 4 0.004887 **
homonymy_third_order_log 17 293.02 355.30 -129.51 259.02 13.813 4 0.007917 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
sjPlot::tab_df(homonyms_log_reported.table,
file="model comparison homonyms log_.doc")
sjPlot::tab_df(round(coef(summary(homonymy_first_order_log)),3),file='homonyms_log_fixed_effects.doc')
homonyms_log_reported.table
[38;5;246m# A tibble: 3 x 4[39m
`Resid. Df` Resid.Dev dAIC AIC_weight
[38;5;250m*[39m [3m[38;5;246m<int>[39m[23m [3m[38;5;246m<dbl>[39m[23m [3m[38;5;246m<dbl>[39m[23m [3m[38;5;246m<dbl>[39m[23m
[38;5;250m1[39m 279 168. 967. 0
[38;5;250m2[39m 274 -[31m784[39m[31m.[39m 0 1
[38;5;250m3[39m 271 193. 954. 0
ggplot(df_homonymy, aes(Generation, Word_repetition_binary, shape=GroupType, linetype=LexiconType)) +
stat_summary(fun.data=mean_se, geom="pointrange") +
stat_summary(aes(y=fitted(homonymy_second_order_log), linetype=LexiconType),
fun.y=mean, geom="line") +
ylab("Proportion of homonymy")
dev.print(pdf,'Homonymy Log by Group and Lexicon type - first order model.pdf')
quartz_off_screen
2
Because there’s discontinuity between Generation/Round 0 and 1, redo the analysis in ‘Homonymy’ without Generation/Round 0 (i.e., only Generations 1-5).
Can’t fit a 3rd order model because there are fewer observations than random effects
homonymy_first_order_1to5 <- lmer(Word_repetition ~
ot1*GroupType*LexiconType + (1|Unique_Participant),
data=df_homonymy[df_homonymy$Generation != 0, ],
control=lmerControl(optimizer = "bobyqa", optCtrl=list(maxfun=1e5)))
homonymy_second_order_1to5 <- lmer(Word_repetition ~
(ot1+ot2)*GroupType*LexiconType + (1|Unique_Participant),
data=df_homonymy[df_homonymy$Generation != 0, ],
control=lmerControl(optimizer = "bobyqa", optCtrl=list(maxfun=1e5)))
summary(homonymy_first_order_1to5)
Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
Formula: Word_repetition ~ ot1 * GroupType * LexiconType + (1 | Unique_Participant)
Data: df_homonymy[df_homonymy$Generation != 0, ]
Control: lmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 1e+05))
REML criterion at convergence: -538.6
Scaled residuals:
Min 1Q Median 3Q Max
-2.26218 -0.42304 -0.07362 0.38388 2.49506
Random effects:
Groups Name Variance Std.Dev.
Unique_Participant (Intercept) 0.006011 0.07753
Residual 0.001809 0.04253
Number of obs: 240, groups: Unique_Participant, 144
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 0.069581 0.009229 96.125742 7.539 2.63e-11 ***
ot1 0.030930 0.013249 197.310275 2.335 0.020568 *
GroupType1 0.036768 0.009229 96.125742 3.984 0.000132 ***
LexiconType1 -0.001947 0.009229 96.125742 -0.211 0.833352
ot1:GroupType1 0.061434 0.013249 197.310275 4.637 6.42e-06 ***
ot1:LexiconType1 0.030930 0.013249 197.310275 2.335 0.020568 *
GroupType1:LexiconType1 0.006560 0.009229 96.125742 0.711 0.478956
ot1:GroupType1:LexiconType1 -0.005383 0.013249 197.310275 -0.406 0.684960
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) ot1 GrpTy1 LxcnT1 ot1:GT1 o1:LT1 GT1:LT
ot1 -0.172
GroupType1 -0.570 -0.107
LexiconTyp1 0.000 0.000 0.000
ot1:GrpTyp1 -0.107 0.624 -0.172 0.000
ot1:LxcnTy1 0.000 0.000 0.000 -0.172 0.000
GrpTyp1:LT1 0.000 0.000 0.000 -0.570 0.000 -0.107
ot1:GT1:LT1 0.000 0.000 0.000 -0.107 0.000 0.624 -0.172
summary(homonymy_second_order_1to5)
Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
Formula: Word_repetition ~ (ot1 + ot2) * GroupType * LexiconType + (1 | Unique_Participant)
Data: df_homonymy[df_homonymy$Generation != 0, ]
Control: lmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 1e+05))
REML criterion at convergence: -513.8
Scaled residuals:
Min 1Q Median 3Q Max
-2.08844 -0.46938 -0.09452 0.41061 2.37937
Random effects:
Groups Name Variance Std.Dev.
Unique_Participant (Intercept) 0.006069 0.07790
Residual 0.001827 0.04274
Number of obs: 240, groups: Unique_Participant, 144
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 0.072678 0.009790 102.368191 7.423 3.49e-11 ***
ot1 0.019823 0.017431 194.408408 1.137 0.256854
ot2 0.016224 0.016434 194.408408 0.987 0.324779
GroupType1 0.038033 0.009790 102.368191 3.885 0.000182 ***
LexiconType1 -0.003479 0.009790 102.368191 -0.355 0.723060
ot1:GroupType1 0.056897 0.017431 194.408408 3.264 0.001298 **
ot2:GroupType1 0.006626 0.016434 194.408408 0.403 0.687251
ot1:LexiconType1 0.036423 0.017431 194.408408 2.090 0.037961 *
ot2:LexiconType1 -0.008023 0.016434 194.408408 -0.488 0.625981
GroupType1:LexiconType1 0.007246 0.009790 102.368191 0.740 0.460913
ot1:GroupType1:LexiconType1 -0.007845 0.017431 194.408408 -0.450 0.653194
ot2:GroupType1:LexiconType1 0.003595 0.016434 194.408408 0.219 0.827057
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) ot1 ot2 GrpTy1 LxcnT1 ot1:GT1 ot2:GT1 o1:LT1 o2:LT1 GT1:LT o1:GT1:
ot1 -0.331
ot2 0.321 -0.645
GroupType1 -0.447 -0.207 0.200
LexiconTyp1 0.000 0.000 0.000 0.000
ot1:GrpTyp1 -0.207 0.624 -0.403 -0.331 0.000
ot2:GrpTyp1 0.200 -0.403 0.624 0.321 0.000 -0.645
ot1:LxcnTy1 0.000 0.000 0.000 0.000 -0.331 0.000 0.000
ot2:LxcnTy1 0.000 0.000 0.000 0.000 0.321 0.000 0.000 -0.645
GrpTyp1:LT1 0.000 0.000 0.000 0.000 -0.447 0.000 0.000 -0.207 0.200
ot1:GT1:LT1 0.000 0.000 0.000 0.000 -0.207 0.000 0.000 0.624 -0.403 -0.331
ot2:GT1:LT1 0.000 0.000 0.000 0.000 0.200 0.000 0.000 -0.403 0.624 0.321 -0.645
homonyms_1to5_model.names <- c("Homonymy first order 1 to 5","Homonymy second order 1 to 5")
homonyms_1to5_summ.table <- do.call(rbind, lapply(list(homonymy_first_order_1to5,homonymy_second_order_1to5), broom::glance))
homonyms_1to5_table.cols <- c("df.residual", "deviance", "AIC")
homonyms_1to5_reported.table <- homonyms_1to5_summ.table[homonyms_1to5_table.cols]
names(homonyms_1to5_reported.table) <- c("Resid. Df", "Resid.Dev", "AIC")
homonyms_1to5_reported.table[['dAIC']] <- with(homonyms_1to5_reported.table, AIC - min(AIC))
homonyms_1to5_reported.table[['AIC_weight']] <- with(homonyms_1to5_reported.table, exp(- 0.5 * dAIC) / sum(exp(- 0.5 * dAIC)))
homonyms_1to5_reported.table$AIC <- NULL
homonyms_1to5_reported.table$AIC_weight <- round(homonyms_1to5_reported.table$AIC_weight, 2)
homonyms_1to5_reported.table$dAIC <- round(homonyms_1to5_reported.table$dAIC, 1)
homonyms_1to5_reported.table$Resid.Dev <- round(homonyms_1to5_reported.table$Resid.Dev, 2)
row.names(homonyms_1to5_reported.table) <- homonyms_1to5_model.names
Setting row names on a tibble is deprecated.
View(homonyms_1to5_reported.table)
anova(homonymy_first_order_1to5,homonymy_second_order_1to5)
refitting model(s) with ML (instead of REML)
Data: df_homonymy[df_homonymy$Generation != 0, ]
Models:
homonymy_first_order_1to5: Word_repetition ~ ot1 * GroupType * LexiconType + (1 | Unique_Participant)
homonymy_second_order_1to5: Word_repetition ~ (ot1 + ot2) * GroupType * LexiconType + (1 |
homonymy_second_order_1to5: Unique_Participant)
Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq)
homonymy_first_order_1to5 10 -578.15 -543.34 299.08 -598.15
homonymy_second_order_1to5 14 -571.96 -523.23 299.98 -599.96 1.8088 4 0.7709
sjPlot::tab_df(homonyms_reported.table,
file="model comparison homonyms_1to5_.doc")
sjPlot::tab_df(round(coef(summary(homonymy_first_order_1to5)),3),file='homonyms_1to5_fixed_effects.doc')
ggplot(df_homonymy[df_homonymy$Generation != 0, ], aes(Generation, Word_repetition, shape=GroupType)) +
stat_summary(fun.data=mean_se, geom="pointrange") +
stat_summary(aes(y=fitted(homonymy_first_order_1to5), linetype=GroupType),
fun.y=mean, geom="line") +
ylab("Proportion of homonymy")
dev.print(pdf,'Homonymy 1to5 by group type - first order model.pdf')
quartz_off_screen
2
ggplot(df_homonymy[df_homonymy$Generation != 0, ], aes(Generation, Word_repetition, color=GroupType)) +
stat_summary(fun.data=mean_se, geom="pointrange") +
stat_summary(aes(y=fitted(homonymy_second_order_1to5), linetype=GroupType),
fun.y=mean, geom="line") +
ylab("Proportion of homonymy")
dev.print(pdf,'Homonymy 1to5 by group type - second order model.pdf')
quartz_off_screen
2
ggplot(df_homonymy[df_homonymy$Generation != 0, ], aes(Generation, Word_repetition, shape=LexiconType)) +
stat_summary(fun.data=mean_se, geom="pointrange") +
stat_summary(aes(y=fitted(homonymy_first_order_1to5), linetype=LexiconType),
fun.y=mean, geom="line") +
ylab("Proportion of homonymy")
dev.print(pdf,'Homonymy 1to5 by lexicon type - first order model.pdf')
quartz_off_screen
2
ggplot(df_homonymy[df_homonymy$Generation != 0, ], aes(Generation, Word_repetition, color=LexiconType)) +
stat_summary(fun.data=mean_se, geom="pointrange") +
stat_summary(aes(y=fitted(homonymy_second_order_1to5), linetype=LexiconType),
fun.y=mean, geom="line") +
ylab("Proportion of homonymy")
dev.print(pdf,'Homonymy 1to5 by lexicon type - second order model.pdf')
quartz_off_screen
2
Two related questions: 1) Is sound repetition more prevelant among homonyms? (i.e., Is sound repetition driven by homonymy?) 2) Do we see the same pattern of sound repetition increase when we look only at non-homonyms?
# This bit of script identifies homonyms in each lexicon
# Identify duplicates within every subset of words
df_u = ddply(df_director, c("GroupType", "LexiconType", "GroupNumber", "Generation", "Unique_language", "Pair", "Unique_Participant"), summarise, dup = duplicated(TypedLabel))
# Paste that information back to the main dateframe
df_u2 = cbind(df_director, df_u$dup)
# List up words that have copies (i.e., homonyms)
homs = unique(subset(df_u2, df_u$dup == 'TRUE'))
# Create variable 'homonym'
df_director = merge(df_director, homs, all.x=TRUE)
colnames(df_director)[52] <- "homonym"
df_director$homonym[is.na(df_director$homonym)] <- 0
# Create a subset without homonyms
NoHoms = subset(df_director, homonym == 0)
Is sound repetition more prevelant among homonyms? The analysis shows no effects of homonymy on CVC. So the answer is NO.
CVC_hom_third_order <- glmer(New_Redup_B ~ #maximal random effect structure, up to cubic term
(ot1+ot2+ot3) * GroupType * LexiconType * homonym + (1|Unique_Participant) + (1|Meaning),
data=df_director, family=binomial,
control=glmerControl(optimizer = "bobyqa", optCtrl=list(maxfun=1e5)))
CVC_hom_second_order <- glmer(New_Redup_B ~ #maximal random effect structure, up to quadratic term
(ot1+ot2) * GroupType * LexiconType * homonym + (1|Unique_Participant) + (1|Meaning),
data=df_director, family=binomial,
control=glmerControl(optimizer = "bobyqa", optCtrl=list(maxfun=1e5)))
CVC_hom_first_order <- glmer(New_Redup_B ~ #maximal random effect structure, up to linear term
ot1 * GroupType * LexiconType * homonym+ (1|Unique_Participant) + (1|Meaning),
data=df_director, family=binomial,
control=glmerControl(optimizer = "bobyqa", optCtrl=list(maxfun=1e5)))
summary(CVC_hom_third_order)
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
Family: binomial ( logit )
Formula: New_Redup_B ~ (ot1 + ot2 + ot3) * GroupType * LexiconType * homonym + (1 | Unique_Participant) + (1 | Meaning)
Data: df_director
Control: glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 1e+05))
AIC BIC logLik deviance df.resid
5031.3 5247.7 -2481.6 4963.3 4259
Scaled residuals:
Min 1Q Median 3Q Max
-2.3200 -0.6451 -0.4361 0.8118 4.9045
Random effects:
Groups Name Variance Std.Dev.
Unique_Participant (Intercept) 0.7452 0.8633
Meaning (Intercept) 0.2845 0.5334
Number of obs: 4293, groups: Unique_Participant, 156; Meaning, 18
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.808121 0.161868 -4.992 5.96e-07 ***
ot1 0.530514 0.190645 2.783 0.00539 **
ot2 0.059379 0.184687 0.322 0.74782
ot3 -0.125553 0.159646 -0.786 0.43161
GroupType1 0.169374 0.092070 1.840 0.06582 .
LexiconType1 -0.049593 0.101573 -0.488 0.62537
homonym 0.017287 0.111668 0.155 0.87697
ot1:GroupType1 0.354165 0.149023 2.377 0.01747 *
ot2:GroupType1 -0.057817 0.147761 -0.391 0.69558
ot3:GroupType1 -0.124834 0.140804 -0.887 0.37530
ot1:LexiconType1 -0.404151 0.190573 -2.121 0.03395 *
ot2:LexiconType1 0.141966 0.184710 0.769 0.44214
ot3:LexiconType1 0.138114 0.159736 0.865 0.38724
GroupType1:LexiconType1 0.023625 0.092056 0.257 0.79746
ot1:homonym -0.428702 0.269405 -1.591 0.11154
ot2:homonym -0.188312 0.259013 -0.727 0.46720
ot3:homonym 0.208112 0.283400 0.734 0.46274
GroupType1:homonym 0.001667 0.118086 0.014 0.98874
LexiconType1:homonym 0.157307 0.111713 1.408 0.15909
ot1:GroupType1:LexiconType1 -0.087180 0.148985 -0.585 0.55844
ot2:GroupType1:LexiconType1 0.069609 0.147621 0.472 0.63725
ot3:GroupType1:LexiconType1 0.030518 0.140665 0.217 0.82824
ot1:GroupType1:homonym -0.312951 0.300124 -1.043 0.29707
ot2:GroupType1:homonym -0.020355 0.284279 -0.072 0.94292
ot3:GroupType1:homonym 0.146422 0.294473 0.497 0.61902
ot1:LexiconType1:homonym 0.470131 0.269451 1.745 0.08102 .
ot2:LexiconType1:homonym -0.151120 0.259282 -0.583 0.56000
ot3:LexiconType1:homonym -0.464340 0.283930 -1.635 0.10196
GroupType1:LexiconType1:homonym 0.055324 0.118077 0.469 0.63940
ot1:GroupType1:LexiconType1:homonym 0.311921 0.299631 1.041 0.29787
ot2:GroupType1:LexiconType1:homonym -0.371302 0.284594 -1.305 0.19200
ot3:GroupType1:LexiconType1:homonym -0.171318 0.294790 -0.581 0.56114
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation matrix not shown by default, as p = 32 > 12.
Use print(x, correlation=TRUE) or
vcov(x) if you need it
summary(CVC_hom_second_order)
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
Family: binomial ( logit )
Formula: New_Redup_B ~ (ot1 + ot2) * GroupType * LexiconType * homonym + (1 | Unique_Participant) + (1 | Meaning)
Data: df_director
Control: glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 1e+05))
AIC BIC logLik deviance df.resid
5019.5 5184.9 -2483.7 4967.5 4267
Scaled residuals:
Min 1Q Median 3Q Max
-2.4627 -0.6439 -0.4370 0.8098 4.9419
Random effects:
Groups Name Variance Std.Dev.
Unique_Participant (Intercept) 0.7694 0.8771
Meaning (Intercept) 0.2838 0.5327
Number of obs: 4293, groups: Unique_Participant, 156; Meaning, 18
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.822339 0.161606 -5.089 3.61e-07 ***
ot1 0.532049 0.169180 3.145 0.00166 **
ot2 0.054258 0.163211 0.332 0.73956
GroupType1 0.183866 0.089818 2.047 0.04065 *
LexiconType1 -0.049034 0.101257 -0.484 0.62821
homonym 0.012110 0.107987 0.112 0.91071
ot1:GroupType1 0.354700 0.146312 2.424 0.01534 *
ot2:GroupType1 -0.066338 0.144222 -0.460 0.64554
ot1:LexiconType1 -0.436948 0.169214 -2.582 0.00982 **
ot2:LexiconType1 0.183205 0.163203 1.123 0.26162
GroupType1:LexiconType1 0.032274 0.089832 0.359 0.71940
ot1:homonym -0.395407 0.267076 -1.481 0.13874
ot2:homonym -0.191363 0.253039 -0.756 0.44949
GroupType1:homonym 0.021833 0.114595 0.191 0.84890
LexiconType1:homonym 0.191095 0.108050 1.769 0.07696 .
ot1:GroupType1:LexiconType1 -0.075072 0.146296 -0.513 0.60785
ot2:GroupType1:LexiconType1 0.063014 0.144094 0.437 0.66189
ot1:GroupType1:homonym -0.279199 0.297604 -0.938 0.34816
ot2:GroupType1:homonym -0.002066 0.278787 -0.007 0.99409
ot1:LexiconType1:homonym 0.420616 0.267177 1.574 0.11542
ot2:LexiconType1:homonym -0.108324 0.253435 -0.427 0.66907
GroupType1:LexiconType1:homonym 0.072695 0.114625 0.634 0.52595
ot1:GroupType1:LexiconType1:homonym 0.281327 0.297159 0.947 0.34378
ot2:GroupType1:LexiconType1:homonym -0.375634 0.279052 -1.346 0.17827
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation matrix not shown by default, as p = 24 > 12.
Use print(x, correlation=TRUE) or
vcov(x) if you need it
summary(CVC_hom_first_order)
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
Family: binomial ( logit )
Formula: New_Redup_B ~ ot1 * GroupType * LexiconType * homonym + (1 | Unique_Participant) + (1 | Meaning)
Data: df_director
Control: glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 1e+05))
AIC BIC logLik deviance df.resid
5007.8 5122.3 -2485.9 4971.8 4275
Scaled residuals:
Min 1Q Median 3Q Max
-2.0930 -0.6449 -0.4398 0.8119 4.8887
Random effects:
Groups Name Variance Std.Dev.
Unique_Participant (Intercept) 0.7811 0.8838
Meaning (Intercept) 0.2809 0.5300
Number of obs: 4293, groups: Unique_Participant, 156; Meaning, 18
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.814540 0.159732 -5.099 3.41e-07 ***
ot1 0.566906 0.150954 3.755 0.000173 ***
GroupType1 0.169273 0.085254 1.986 0.047088 *
LexiconType1 -0.043873 0.099073 -0.443 0.657881
homonym -0.006704 0.106605 -0.063 0.949856
ot1:GroupType1 0.344893 0.141388 2.439 0.014714 *
ot1:LexiconType1 -0.338426 0.150828 -2.244 0.024846 *
GroupType1:LexiconType1 -0.001813 0.085254 -0.021 0.983030
ot1:homonym -0.313368 0.250258 -1.252 0.210504
GroupType1:homonym 0.009150 0.112178 0.082 0.934989
LexiconType1:homonym 0.161239 0.106657 1.512 0.130597
ot1:GroupType1:LexiconType1 -0.049182 0.141349 -0.348 0.727882
ot1:GroupType1:homonym -0.253993 0.286781 -0.886 0.375796
ot1:LexiconType1:homonym 0.431257 0.250513 1.721 0.085161 .
GroupType1:LexiconType1:homonym 0.085663 0.112201 0.763 0.445179
ot1:GroupType1:LexiconType1:homonym 0.322176 0.286629 1.124 0.261005
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation matrix not shown by default, as p = 16 > 12.
Use print(x, correlation=TRUE) or
vcov(x) if you need it
CVC_hom_model.names <- c("CVC_hom first order","CVC_hom second order","CVC_hom third order")
CVC_hom_summ.table <- do.call(rbind, lapply(list(CVC_hom_first_order,CVC_hom_second_order,CVC_hom_third_order), broom::glance))
CVC_hom_table.cols <- c("df.residual", "deviance", "AIC")
CVC_hom_reported.table <- CVC_hom_summ.table[CVC_hom_table.cols]
names(CVC_hom_reported.table) <- c("Resid.Df", "Resid.Dev", "AIC")
CVC_hom_reported.table[['dAIC']] <- with(CVC_hom_reported.table, AIC - min(AIC))
CVC_hom_reported.table[['AIC_weight']] <- with(CVC_hom_reported.table, exp(- 0.5 * dAIC) / sum(exp(- 0.5 * dAIC)))
CVC_hom_reported.table$AIC <- NULL
CVC_hom_reported.table$AIC_weight <- round(CVC_hom_reported.table$AIC_weight, 2)
CVC_hom_reported.table$dAIC <- round(CVC_hom_reported.table$dAIC, 1)
CVC_hom_reported.table$Resid.Dev <- round(CVC_hom_reported.table$Resid.Dev, 2)
row.names(CVC_hom_reported.table) <- CVC_hom_model.names
Setting row names on a tibble is deprecated.
View(CVC_hom_reported.table)
sjPlot::tab_df(CVC_hom_reported.table,
file="model comparison CVC_hom.doc")
Here, an anlaysis is run using only words that don’t have any homonyms. We get pretty much the same results as the analysis with all words. So sound repetition increases regardless of homonymy.
CVC_NH_third_order <- glmer(New_Redup_B ~ #maximal random effect structure, up to cubic term
(ot1+ot2+ot3) * GroupType * LexiconType + (1|Unique_Participant) + (1|Meaning),
data=df_director[df_director$homonym == 0, ], family=binomial,
control=glmerControl(optimizer = "bobyqa", optCtrl=list(maxfun=1e5)))
CVC_NH_second_order <- glmer(New_Redup_B ~ #maximal random effect structure, up to quadratic term
(ot1+ot2) * GroupType * LexiconType + (1|Unique_Participant) + (1|Meaning),
data=df_director[df_director$homonym == 0, ], family=binomial,
control=glmerControl(optimizer = "bobyqa", optCtrl=list(maxfun=1e5)))
CVC_NH_first_order <- glmer(New_Redup_B ~ #maximal random effect structure, up to linear term
ot1 * GroupType * LexiconType + (1|Unique_Participant) + (1|Meaning),
data=df_director[df_director$homonym == 0, ], family=binomial,
control=glmerControl(optimizer = "bobyqa", optCtrl=list(maxfun=1e5)))
summary(CVC_NH_third_order)
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
Family: binomial ( logit )
Formula: New_Redup_B ~ (ot1 + ot2 + ot3) * GroupType * LexiconType + (1 | Unique_Participant) + (1 | Meaning)
Data: df_director[df_director$homonym == 0, ]
Control: glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 1e+05))
AIC BIC logLik deviance df.resid
3947.7 4057.9 -1955.8 3911.7 3358
Scaled residuals:
Min 1Q Median 3Q Max
-2.1583 -0.6286 -0.4412 0.8176 4.0566
Random effects:
Groups Name Variance Std.Dev.
Unique_Participant (Intercept) 0.7569 0.8700
Meaning (Intercept) 0.2940 0.5422
Number of obs: 3376, groups: Unique_Participant, 154; Meaning, 18
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.81889 0.16432 -4.984 6.24e-07 ***
ot1 0.55213 0.19351 2.853 0.00433 **
ot2 0.04084 0.18702 0.218 0.82712
ot3 -0.12438 0.16215 -0.767 0.44303
GroupType1 0.16855 0.09369 1.799 0.07202 .
LexiconType1 -0.04253 0.10278 -0.414 0.67900
ot1:GroupType1 0.34547 0.15358 2.249 0.02449 *
ot2:GroupType1 -0.05535 0.15167 -0.365 0.71514
ot3:GroupType1 -0.13376 0.14404 -0.929 0.35309
ot1:LexiconType1 -0.41155 0.19331 -2.129 0.03326 *
ot2:LexiconType1 0.14179 0.18702 0.758 0.44836
ot3:LexiconType1 0.17699 0.16215 1.092 0.27505
GroupType1:LexiconType1 0.01105 0.09367 0.118 0.90609
ot1:GroupType1:LexiconType1 -0.09222 0.15349 -0.601 0.54798
ot2:GroupType1:LexiconType1 0.07024 0.15146 0.464 0.64281
ot3:GroupType1:LexiconType1 0.06170 0.14375 0.429 0.66774
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation matrix not shown by default, as p = 16 > 12.
Use print(x, correlation=TRUE) or
vcov(x) if you need it
summary(CVC_NH_second_order)
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
Family: binomial ( logit )
Formula: New_Redup_B ~ (ot1 + ot2) * GroupType * LexiconType + (1 | Unique_Participant) + (1 | Meaning)
Data: df_director[df_director$homonym == 0, ]
Control: glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 1e+05))
AIC BIC logLik deviance df.resid
3942.0 4027.8 -1957.0 3914.0 3362
Scaled residuals:
Min 1Q Median 3Q Max
-2.1585 -0.6324 -0.4414 0.8190 4.0866
Random effects:
Groups Name Variance Std.Dev.
Unique_Participant (Intercept) 0.7671 0.8758
Meaning (Intercept) 0.2944 0.5426
Number of obs: 3376, groups: Unique_Participant, 154; Meaning, 18
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.83447 0.16392 -5.091 3.57e-07 ***
ot1 0.56774 0.17316 3.279 0.00104 **
ot2 0.02413 0.16592 0.145 0.88438
GroupType1 0.17729 0.09219 1.923 0.05447 .
LexiconType1 -0.03698 0.10190 -0.363 0.71669
ot1:GroupType1 0.34903 0.14977 2.330 0.01978 *
ot2:GroupType1 -0.06655 0.14699 -0.453 0.65069
ot1:LexiconType1 -0.48696 0.17319 -2.812 0.00493 **
ot2:LexiconType1 0.21926 0.16597 1.321 0.18647
GroupType1:LexiconType1 0.02109 0.09219 0.229 0.81903
ot1:GroupType1:LexiconType1 -0.07581 0.14970 -0.506 0.61257
ot2:GroupType1:LexiconType1 0.05613 0.14683 0.382 0.70226
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) ot1 ot2 GrpTy1 LxcnT1 ot1:GT1 ot2:GT1 o1:LT1 o2:LT1 GT1:LT o1:GT1:
ot1 -0.079
ot2 0.053 -0.409
GroupType1 -0.292 -0.049 0.051
LexiconTyp1 -0.052 0.019 0.003 0.035
ot1:GrpTyp1 -0.114 0.252 0.059 0.133 -0.011
ot2:GrpTyp1 0.102 0.061 0.256 -0.155 0.032 -0.231
ot1:LxcnTy1 0.016 -0.115 0.059 0.031 -0.126 0.047 -0.045
ot2:LxcnTy1 0.000 0.061 -0.108 -0.010 0.087 -0.044 0.023 -0.411
GrpTyp1:LT1 0.020 0.031 -0.010 -0.098 -0.467 0.070 -0.041 -0.050 0.051
ot1:GT1:LT1 -0.006 0.047 -0.045 0.070 -0.184 -0.158 0.089 0.252 0.058 0.132
ot2:GT1:LT1 0.018 -0.043 0.022 -0.041 0.170 0.089 -0.153 0.060 0.256 -0.156 -0.232
summary(CVC_NH_first_order)
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
Family: binomial ( logit )
Formula: New_Redup_B ~ ot1 * GroupType * LexiconType + (1 | Unique_Participant) + (1 | Meaning)
Data: df_director[df_director$homonym == 0, ]
Control: glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 1e+05))
AIC BIC logLik deviance df.resid
3936.2 3997.4 -1958.1 3916.2 3366
Scaled residuals:
Min 1Q Median 3Q Max
-2.1879 -0.6298 -0.4443 0.8141 4.0565
Random effects:
Groups Name Variance Std.Dev.
Unique_Participant (Intercept) 0.7765 0.8812
Meaning (Intercept) 0.2940 0.5422
Number of obs: 3376, groups: Unique_Participant, 154; Meaning, 18
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.82883 0.16313 -5.081 3.76e-07 ***
ot1 0.59170 0.15573 3.800 0.000145 ***
GroupType1 0.16758 0.09083 1.845 0.065048 .
LexiconType1 -0.04619 0.10063 -0.459 0.646240
ot1:GroupType1 0.33463 0.14472 2.312 0.020759 *
ot1:LexiconType1 -0.39614 0.15553 -2.547 0.010865 *
GroupType1:LexiconType1 0.01167 0.09084 0.128 0.897811
ot1:GroupType1:LexiconType1 -0.07951 0.14466 -0.550 0.582574
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) ot1 GrpTy1 LxcnT1 ot1:GT1 o1:LT1 GT1:LT
ot1 -0.082
GroupType1 -0.285 0.002
LexiconTyp1 -0.061 0.018 0.054
ot1:GrpTyp1 -0.101 0.372 0.096 -0.011
ot1:LxcnTy1 0.014 -0.090 0.034 -0.131 0.009
GrpTyp1:LT1 0.031 0.035 -0.123 -0.458 0.076 0.001
ot1:GT1:LT1 -0.006 0.009 0.076 -0.162 -0.118 0.372 0.096
CVC_NH_model.names <- c("CVC_NH first order","CVC_NH second order","CVC_NH third order")
CVC_NH_summ.table <- do.call(rbind, lapply(list(CVC_NH_first_order,CVC_NH_second_order,CVC_NH_third_order), broom::glance))
CVC_NH_table.cols <- c("df.residual", "deviance", "AIC")
CVC_NH_reported.table <- CVC_NH_summ.table[CVC_NH_table.cols]
names(CVC_NH_reported.table) <- c("Resid.Df", "Resid.Dev", "AIC")
CVC_NH_reported.table[['dAIC']] <- with(CVC_NH_reported.table, AIC - min(AIC))
CVC_NH_reported.table[['AIC_weight']] <- with(CVC_NH_reported.table, exp(- 0.5 * dAIC) / sum(exp(- 0.5 * dAIC)))
CVC_NH_reported.table$AIC <- NULL
CVC_NH_reported.table$AIC_weight <- round(CVC_NH_reported.table$AIC_weight, 2)
CVC_NH_reported.table$dAIC <- round(CVC_NH_reported.table$dAIC, 1)
CVC_NH_reported.table$Resid.Dev <- round(CVC_NH_reported.table$Resid.Dev, 2)
row.names(CVC_NH_reported.table) <- CVC_NH_model.names
Setting row names on a tibble is deprecated.
View(CVC_NH_reported.table)
sjPlot::tab_df(CVC_NH_reported.table,
file="model comparison CVC_NH.doc")
Here’s a plot showing the proportion of CVC repetition in non-homonyms
ggplot(NoHoms, aes(Generation, New_Redup_B, shape=GroupType)) +
stat_summary(fun.data=mean_se, geom="pointrange") +
stat_summary(aes(y=fitted(CVC_NH_first_order), linetype=GroupType),
fun.y=mean, geom="line") +
ylab("Consonant repetition")+
ggtitle('Consonant repetition in non-homonyms by group type')
dev.print(pdf, 'Consonant repetition in non-homonyms by group type - first order model.pdf')
quartz_off_screen
2
ggplot(NoHoms, aes(Generation, New_Redup_B, shape=LexiconType)) +
stat_summary(fun.data=mean_se, geom="pointrange") +
stat_summary(aes(y=fitted(CVC_NH_first_order), linetype=LexiconType),
fun.y=mean, geom="line") +
ylab("Consonant repetition")+
ggtitle('Consonant repetition in non-homonyms by lexicon size')
dev.print(pdf, 'Consonant repetition in non-homonyms by lexicon size - first order model.pdf')
quartz_off_screen
2
A query raised by Jenny is whether the repetition effects could be driven by word length - so longer words will be more likely to contain repetitions and words get longer in the chains than in the closed groups.
As the analysis below shows, there’s obviously a clear association between word length and sound repetition, although the direction of the causality could be rep -> length.
df_director_generations_1_to_5$LabelLength = nchar(as.character(df_director_generations_1_to_5$TypedLabel))
RepXLength = ddply(df_director_generations_1_to_5, c("LabelLength"), summarise, mean.rep = mean(New_Redup_B))
ggplot(RepXLength, aes(x=LabelLength, y=mean.rep)) +
geom_point(shape=1) +
geom_smooth(method=lm)
summary(lm(LabelLength ~ mean.rep, data=RepXLength))
Call:
lm(formula = LabelLength ~ mean.rep, data = RepXLength)
Residuals:
Min 1Q Median 3Q Max
-0.7622 -0.6932 -0.4123 0.1943 2.3114
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 2.9359 0.6501 4.516 0.00196 **
mean.rep 8.8263 1.0806 8.168 3.76e-05 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 1.051 on 8 degrees of freedom
Multiple R-squared: 0.8929, Adjusted R-squared: 0.8795
F-statistic: 66.71 on 1 and 8 DF, p-value: 3.759e-05
So, can this explain why we find a GroupType or LexiconSize effect on repetition? Here’s a figure showing the average label length by GroupType and LexiconSize, followed by a set of GCA analyses. The linear analysis (best fit) shows that label length increases over time, but this increase doesn’t interact with GroupType or LexiconSize.
df_director_plot$LabelLength = nchar(as.character(df_director$TypedLabel))
ggplot(df_director_plot, aes(Generation, LabelLength, group = group_id, colour=GroupType, linetype=LexiconType)) +
stat_summary(fun.data=mean_se, geom="line") +
ylab("Label length")+
ggtitle('Label length by group type and lexicon size')
dev.print(pdf, 'Label length by group and lexicon.pdf')
quartz_off_screen
2
LabelLength_third_order <- lmer(LabelLength ~ #maximal random effect structure, up to cubic term
(ot1+ot2+ot3) * GroupType * LexiconType + (1|Unique_Participant) + (1|Meaning),
data=df_director_plot,
control=lmerControl(optimizer = "bobyqa", optCtrl=list(maxfun=1e5)))
LabelLength_second_order <- lmer(LabelLength ~ #maximal random effect structure, up to quadratic term
(ot1+ot2) * GroupType * LexiconType + (1|Unique_Participant) + (1|Meaning),
data=df_director_plot,
control=lmerControl(optimizer = "bobyqa", optCtrl=list(maxfun=1e5)))
LabelLength_first_order <- lmer(LabelLength ~ #maximal random effect structure, up to linear term
ot1 * GroupType * LexiconType + (1|Unique_Participant) + (1|Meaning),
data=df_director_plot,
control=lmerControl(optimizer = "bobyqa", optCtrl=list(maxfun=1e5)))
summary(LabelLength_third_order)
Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
Formula: LabelLength ~ (ot1 + ot2 + ot3) * GroupType * LexiconType + (1 | Unique_Participant) + (1 | Meaning)
Data: df_director_plot
Control: lmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 1e+05))
REML criterion at convergence: 13516.3
Scaled residuals:
Min 1Q Median 3Q Max
-2.2978 -0.9185 0.0555 0.7996 4.3738
Random effects:
Groups Name Variance Std.Dev.
Unique_Participant (Intercept) 0.1601 0.4001
Meaning (Intercept) 0.1472 0.3836
Residual 2.3832 1.5437
Number of obs: 3593, groups: Unique_Participant, 144; Meaning, 18
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 5.81076 0.12002 42.70091 48.415 <2e-16 ***
ot1 0.08351 0.22632 382.78778 0.369 0.712
ot2 0.09782 0.20861 382.45038 0.469 0.639
ot3 -0.12489 0.15179 382.47872 -0.823 0.411
GroupType1 0.01926 0.07815 159.29109 0.246 0.806
LexiconType1 0.07036 0.07894 165.71974 0.891 0.374
ot1:GroupType1 0.24891 0.22632 382.78755 1.100 0.272
ot2:GroupType1 -0.09212 0.20861 382.45109 -0.442 0.659
ot3:GroupType1 0.07308 0.15179 382.47881 0.481 0.630
ot1:LexiconType1 0.02873 0.22632 382.78778 0.127 0.899
ot2:LexiconType1 0.08342 0.20861 382.45038 0.400 0.689
ot3:LexiconType1 -0.02707 0.15179 382.47872 -0.178 0.859
GroupType1:LexiconType1 -0.01431 0.07815 159.29109 -0.183 0.855
ot1:GroupType1:LexiconType1 -0.10883 0.22632 382.78755 -0.481 0.631
ot2:GroupType1:LexiconType1 0.21399 0.20861 382.45109 1.026 0.306
ot3:GroupType1:LexiconType1 -0.03872 0.15179 382.47881 -0.255 0.799
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation matrix not shown by default, as p = 16 > 12.
Use print(x, correlation=TRUE) or
vcov(x) if you need it
summary(LabelLength_second_order)
Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
Formula: LabelLength ~ (ot1 + ot2) * GroupType * LexiconType + (1 | Unique_Participant) + (1 | Meaning)
Data: df_director_plot
Control: lmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 1e+05))
REML criterion at convergence: 13509.7
Scaled residuals:
Min 1Q Median 3Q Max
-2.3002 -0.9184 0.0567 0.7941 4.3754
Random effects:
Groups Name Variance Std.Dev.
Unique_Participant (Intercept) 0.1566 0.3957
Meaning (Intercept) 0.1472 0.3836
Residual 2.3825 1.5435
Number of obs: 3593, groups: Unique_Participant, 144; Meaning, 18
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 5.767291 0.107556 28.241490 53.621 <2e-16 ***
ot1 0.239329 0.123528 393.791328 1.937 0.0534 .
ot2 -0.044399 0.116430 393.374745 -0.381 0.7032
GroupType1 0.044712 0.057188 95.010423 0.782 0.4363
LexiconType1 0.060894 0.058245 102.250965 1.045 0.2983
ot1:GroupType1 0.157709 0.123528 393.790878 1.277 0.2025
ot2:GroupType1 -0.008871 0.116430 393.375363 -0.076 0.9393
ot1:LexiconType1 0.062535 0.123528 393.791328 0.506 0.6130
ot2:LexiconType1 0.052586 0.116430 393.374745 0.452 0.6518
GroupType1:LexiconType1 -0.027742 0.057188 95.010423 -0.485 0.6287
ot1:GroupType1:LexiconType1 -0.060586 0.123528 393.790878 -0.490 0.6241
ot2:GroupType1:LexiconType1 0.169946 0.116430 393.375363 1.460 0.1452
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) ot1 ot2 GrpTy1 LxcnT1 ot1:GT1 ot2:GT1 o1:LT1 o2:LT1 GT1:LT o1:GT1:
ot1 -0.214
ot2 0.207 -0.646
GroupType1 -0.180 -0.128 0.125
LexiconTyp1 -0.054 0.052 -0.051 0.000
ot1:GrpTyp1 -0.068 0.320 -0.207 -0.402 0.000
ot2:GrpTyp1 0.066 -0.207 0.321 0.389 0.000 -0.646
ot1:LxcnTy1 0.029 -0.134 0.087 0.000 -0.395 0.000 0.000
ot2:LxcnTy1 -0.028 0.087 -0.135 0.000 0.382 0.000 0.000 -0.646
GrpTyp1:LT1 0.000 0.000 0.000 -0.067 -0.332 0.054 -0.052 -0.128 0.125
ot1:GT1:LT1 0.000 0.000 0.000 0.054 -0.126 -0.134 0.087 0.320 -0.207 -0.402
ot2:GT1:LT1 0.000 0.000 0.000 -0.052 0.122 0.087 -0.135 -0.207 0.321 0.389 -0.646
summary(LabelLength_first_order)
Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
Formula: LabelLength ~ ot1 * GroupType * LexiconType + (1 | Unique_Participant) + (1 | Meaning)
Data: df_director_plot
Control: lmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 1e+05))
REML criterion at convergence: 13502
Scaled residuals:
Min 1Q Median 3Q Max
-2.2831 -0.9189 0.0570 0.7992 4.3589
Random effects:
Groups Name Variance Std.Dev.
Unique_Participant (Intercept) 0.1555 0.3943
Meaning (Intercept) 0.1471 0.3836
Residual 2.3818 1.5433
Number of obs: 3593, groups: Unique_Participant, 144; Meaning, 18
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 5.77577 0.10515 25.90582 54.929 <2e-16 ***
ot1 0.20880 0.09422 400.08135 2.216 0.0272 *
GroupType1 0.04636 0.05254 80.49492 0.882 0.3802
LexiconType1 0.05089 0.05369 87.80078 0.948 0.3458
ot1:GroupType1 0.15172 0.09422 400.08027 1.610 0.1081
ot1:LexiconType1 0.09840 0.09422 400.08135 1.044 0.2969
GroupType1:LexiconType1 -0.06024 0.05254 80.49492 -1.147 0.2550
ot1:GroupType1:LexiconType1 0.05586 0.09422 400.08027 0.593 0.5536
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) ot1 GrpTy1 LxcnT1 ot1:GT1 o1:LT1 GT1:LT
ot1 -0.107
GroupType1 -0.227 -0.068
LexiconTyp1 -0.049 0.028 0.000
ot1:GrpTyp1 -0.034 0.320 -0.214 0.000
ot1:LxcnTy1 0.015 -0.134 0.000 -0.210 0.000
GrpTyp1:LT1 0.000 0.000 -0.056 -0.445 0.029 -0.068
ot1:GT1:LT1 0.000 0.000 0.029 -0.067 -0.134 0.320 -0.214
LabelLength_model.names <- c("LabelLength first order","LabelLength second order","LabelLength third order")
LabelLength_summ.table <- do.call(rbind, lapply(list(LabelLength_first_order,LabelLength_second_order,LabelLength_third_order), broom::glance))
LabelLength_table.cols <- c("df.residual", "deviance", "AIC")
LabelLength_reported.table <- LabelLength_summ.table[LabelLength_table.cols]
names(LabelLength_reported.table) <- c("Resid.Df", "Resid.Dev", "AIC")
LabelLength_reported.table[['dAIC']] <- with(LabelLength_reported.table, AIC - min(AIC))
LabelLength_reported.table[['AIC_weight']] <- with(LabelLength_reported.table, exp(- 0.5 * dAIC) / sum(exp(- 0.5 * dAIC)))
LabelLength_reported.table$AIC <- NULL
LabelLength_reported.table$AIC_weight <- round(LabelLength_reported.table$AIC_weight, 2)
LabelLength_reported.table$dAIC <- round(LabelLength_reported.table$dAIC, 1)
LabelLength_reported.table$Resid.Dev <- round(LabelLength_reported.table$Resid.Dev, 2)
row.names(LabelLength_reported.table) <- LabelLength_model.names
Setting row names on a tibble is deprecated.
View(LabelLength_reported.table)
sjPlot::tab_df(LabelLength_reported.table,
file="model comparison LabelLength.doc")
For good measure, we can rerun our CVC analysis with LabelLength thrown in as a fixed effect (just the first-order analysis). Although LabelLength gobbles up the effects, there’s still enough left in the Time x GroupType and Time x LexiconSize interactions to give us assurance that these factors cannot be explained away.
CVC_LabelLength_first_order <- glmer(New_Redup_B ~ #maximal random effect structure, up to linear term
ot1 * GroupType * LexiconType + LabelLength + (1|Unique_Participant) + (1|Meaning),
data=df_director_plot, family=binomial,
control=glmerControl(optimizer = "bobyqa", optCtrl=list(maxfun=1e5)))
summary(CVC_LabelLength_first_order)
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
Family: binomial ( logit )
Formula: New_Redup_B ~ ot1 * GroupType * LexiconType + LabelLength + (1 | Unique_Participant) + (1 | Meaning)
Data: df_director_plot
Control: glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 1e+05))
AIC BIC logLik deviance df.resid
3989.7 4057.7 -1983.8 3967.7 3582
Scaled residuals:
Min 1Q Median 3Q Max
-2.7899 -0.6254 -0.3697 0.7177 3.9017
Random effects:
Groups Name Variance Std.Dev.
Unique_Participant (Intercept) 0.8765 0.9362
Meaning (Intercept) 0.2977 0.5456
Number of obs: 3593, groups: Unique_Participant, 144; Meaning, 18
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -2.94850 0.23698 -12.442 < 2e-16 ***
ot1 0.52922 0.17541 3.017 0.00255 **
GroupType1 0.18926 0.11488 1.647 0.09947 .
LexiconType1 -0.04797 0.11606 -0.413 0.67936
LabelLength 0.35762 0.02676 13.363 < 2e-16 ***
ot1:GroupType1 0.31927 0.17535 1.821 0.06865 .
ot1:LexiconType1 -0.35218 0.17530 -2.009 0.04454 *
GroupType1:LexiconType1 0.04995 0.11486 0.435 0.66364
ot1:GroupType1:LexiconType1 -0.04625 0.17522 -0.264 0.79182
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) ot1 GrpTy1 LxcnT1 LblLng ot1:GT1 o1:LT1 GT1:LT
ot1 -0.092
GroupType1 -0.264 -0.101
LexiconTyp1 -0.016 0.023 -0.003
LabelLength -0.681 -0.004 0.004 -0.013
ot1:GrpTyp1 -0.046 0.518 -0.193 0.003 -0.007
ot1:LxcnTy1 0.032 -0.083 0.003 -0.191 -0.029 -0.021
GrpTyp1:LT1 -0.015 0.002 -0.029 -0.535 0.020 0.023 -0.101
ot1:GT1:LT1 0.011 -0.021 0.024 -0.100 -0.013 -0.083 0.518 -0.193